As well as managing our own codes and documents, another important use of version control is for collaboration...
As already discussed, Git uses a “distributed” model that allows everyone working on a project to have their own independent copy of the entire repository. To collaborate effectively though we need a central version of the code base which is used to unify everyones’ efforts. Typically the best place for such a central repository is online.
There are a number of excellent options for online hosting of git repositories (for a list see this Wikipedia entry). However, there are two options in particular which stand out in my opinion:
If you have the address (and correct permissions) for an online repository then you can grab your own copy using the clone command. Try cloning your own copy of the source for this tutorial (make sure you are not in your a_paper repository when you do this):
% git clone git://github.com/smutch/VersionControlTutorial.git
% cd VersionControlTutorial
You are now inside your own personal copy of the repository and can do whatever you want with it. Try:
% git lg
and you will see that you also have the full commit history.
Unfortunately, it is out-with the scope of this tutorial to cover all of the different ways you can collaborate with Git. There are a number of options for how to get your changes incorporated into the central repository for everyone to have access to. These include, forking and pull requests, email patches, and direct pushing.
The basic work-flow is almost always the same though: