Today we will discuss the idea of version control more fully than we have in past courses. We will then walk through git and GitHub, the primary syntax and host currently used for version control.
For today’s class, I asked you to read, “Git can facilitate greater reproducibility and increased transparency in science”, by Karthik Ram. Let’s discuss it with the following guiding questions:
From the git website http://git-scm.com/
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
With so many other (read: easier!) ways to share and collaborate on documents, why use git? Isn’t it a bit overkill to learn an entirely new syntax? Why not just email files or use something like DropBox? Because it is very easy to end up with something like this:
Credit: Jorge Chan
\[ Project = f(size, scope, collaborators) \]
As any part of that function grows, so too does the need for a work flow that:
Git was designed to do all these things, so it works better than other systems.
Yep, you guessed it. Git is the system/language that supports version control. GitHub is an online service that will host your remote repositories, for free if public or a small fee if private. (Students get an education discount and some free repos. Check out https://education.github.com/.)
GitHub also provides a lovely GUI that automates much of the git workflow. If you want to run git at the command line, go for it! But using the GUI is fine.
sync
your local repo with your remote repo before starting any work. This makes sure you have the latest files. The GitHub GUI has a sync
button on the top right of the window. (Sync
is really just a pull
command.)push
your commits. Just like you save your papers every few lines or paragraphs, you should push to your remote repo. This way, you’re less likely to lose work in the event of a computer crash. Also, should you want to return to a prior version, small changes make it easier to find what you want.commit
messages. The GitHub GUI will make you add something. Don’t say “stuff.” A version history of 95 “stuff”s is pretty non-helpful..gitignore
to make sure that git doesn’t track or push them.For class today, I want you to try to accomplish the following tasks.
First, complete the try.github.io tutorial. It should take just a few minutes. It will, however, make you use the command line method.
After completing the tutorial, try to complete the following tasks with your own GitHub account. You can use the GitHub GUI this time, or if you’re feeling bold, the command line/terminal.
hello.txt
to your cloned repo (on your machine) that says “Hello, World!”.hello.txt
file locally, commit and push the change to the repo. Check the change on GitHub.hello.txt
file using GitHub’s editor and save it remotely. Use the GitHub GUI to sync your change locally.Init: 30 August 2015; Updated: 31 August 2015