Tool of the Week: GitHub

In any sort of research, chances are you're going to have to write some code, be it in Matlab, R, or Javascript, or some other processing language.  Having the ability to share your codes with others, and truly collorabirate is extremly useful in being productive.  You could share your codes via a file sharing service like Dropbox, but at least to me it's a bit scary to think someone could break your working version of code.  Having multiple copies of code can quickly become cumbersome, and confusing.  Luckily, GitHub provides a better way to share and collaborate on code, while providing version control.  And it's free.

GitHub works based on collections of Codes called "Repositories" (or "Repos").  You can download a working version of a repository from the cloud, and change it without affecting other users using the same repo.  When you're happy with your changes, you can describe what you've done and push your version back to the cloud.  At this point, other users have a choice: Github will show other users your changes and they can either resync their codes with the live one on the cloud, or create a "Fork" where their codes will will be diffrent from yours.  It is later possible to merge Forks, if you like the version someone else is using better.  If things are utterly broken, you can always back up the tree to a working version.  The idea here is you're in control of the code you're using: Nobody can break it except you.  But you're sharing your code with collaborators, which can help everybody's productivity.

Until recently, GitHub was a little bit of a pain to use, running solely on unix commands.  Now, GitHub has an awesome app for mac that works amazing, and makes GitHub super easy to use.  Windows users are going to be stuck using GitHub's web interface, which offers similar features but can involved uploading and downloading large batches of files from the internet with every sync.

Screenshot from GitHub's Mac App Interface. Note: The Web Interface has similar features.

If you look at the screenshot of the GitHub app, you can see a lot of what's going on. First: It's showing me the files i've recently changed, as well as what the changes are on the right (Green = addition , red = deletion). In the bottom left it tells me i'm working in the master branch. If i were to fork off the master, it would let me know, and let me compare two files. The "Uncommitted changes" tells me that the changes here are local, and i haven't pushed them to the master branch in the cloud yet. If i desired to, i could enter in comments about my changes and sync them to the master branch.

Here's another example of GitHub's power.  Below i'm showing a historical version.  Notice the breif comments at the top, and then the red and green highlight's showing what changed.  If Later I don't like these changes, i can revert them or revert all my code back to this state.  I could also revert in a new branch, not affecting the master code.

Historical Revisions in the GitHub app

I hope you find GitHub as useful as I do! I'm slowly convincing my entire research group to use it to collaborate on our codes

Related Posts:

This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.