At the beginning, I was used to keep all my sources on Dropbox. Even if this service is clearly useful for backuping current work whatever the kind of files, for coding, specifically, you can find far more powerful tools. Source codes can be shared between developers using distributed version control systems. If you are acquainted to Linux, you cannot have missed Subversion or GIT. These are very powerful software designed for developing large collaborative applications.
It happens that they can be used for whatever the size of your programs. Even if you are alone, they provide a reliable backup system and something very interesting when coding, the version management. Thanks to cloud based services like GitHub, the server part is set-up for you, you just have to use it. Even better, it’s absolutely free if you accept to keep public your repositories. I will describe here the typical workflow of a single developer using GitHub.
Initial configuration
You first have to obviously create an account on GitHub. Then, I suggest you to read this help page on GitHub first. And now, to make it simple I recommend to create the repos directly from GitHub.
The next step is to “clone” the repository to your local drive. To do that, use the following command:
arnaud@hercules:~/Documents/GitHub/git clone https://github.com/github_username/repo_name.git
A new folder should have been created containing the files you have created during the repository creation process. You can move into this new folder and start coding.
When you want to upload your new sources or update the modified ones, you need to process the following three steps.
Step 1: select the files
This is done with the following command:
git add some_file
You may prefer to add all files from the repository:
git add .
Step 2: package the new or updated files into a commit
This step is done with the following command:
git commit -m 'some comments'
The comment is mandatory. If you have deleted some files and want to have them removed from the server, add the -a option:
git commit -a -m 'some comments'
Step 3: push the commit to the server
This final operation will update the repository on GitHub. This is done with the command:
git push origin master
Here is an example of the messages that are sent back by the commands described above:
arnaud@hercules:~/Documents/GitHub/python_snippets$ git add . arnaud@hercules:~/Documents/GitHub/python_snippets$ git commit -m 'read keayboard using cmd' [master 7c92177] read keayboard using cmd 2 files changed, 3 insertions(+), 1 deletion(-) arnaud@hercules:~/Documents/GitHub/python_snippets$ git push origin master Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 526 bytes, done. Total 4 (delta 3), reused 0 (delta 0) To https://github.com/Arn-O/python_snippets.git fac4b43..7c92177 master -> master
If you decide to use GitHub or any other distributed control system based on GitHub, those 3 commands will soon become your daily routine.
Step 4: pull the modification
If the code stored on GitHub is in a different version from your local clone, if you have done modification from another computer for example, you will have to pull them:
git push origin master
Have fun with GitHub!
Clik here to view.
![GitHub survival kit for Linux [social coding] GitHub the social coding plateform GitHub survival kit for Linux [social coding]](http://zombiebrainzjuice.cc/wp-content/uploads/2013/08/GitHub-the-social-coding-plateform.png)
GitHub: the social coding plateform
The post GitHub survival kit for Linux [social coding] appeared first on Zombie Brainz' Juice.