This page is a basic introduction to using git for source control. This is in no way a comprehensive guide. There are many ways to do things, especially with git. This is just one way that I chose for its simplicity.
Assumptions:
Make a new repository on your prefered hosting service. I recommend github. Some other great options:
Once you create a repository, you need to get the repository's url. It will look something like: https://github.com/eriq-augustine/bird-catcher.git Make sure you use a private repository for anything the other students should not be able to see (like most programs).
Now you need to clone the repository:
git clone https://github.com/eriq-augustine/bird-catcher.git
git pull
git add <changed files ...>
git commit -m "Some commit message"
git commit -a -m "Some commit message"
git push
git reset --hard HEAD
git checkout HEAD someFile
git checkout -b newBranchName
git checkout branchName
git checkout branchName
git merge master
git checkout master
git merge branchName
git pull
Do some work ...
git add <files ...>
git commit -m "Some useful commit message."
git push
The git on the school servers is an older version (1.7.1) and does not let you push using https (the default mode for github). It will give an error like:
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/eriq-augustine/squid.git/info/refs
fatal: HTTP request failed
To fix this, you can use a version of git that I built from source and host on my school home directory (version 2.8.0 rc2).
You can access this version by running: ~eaugusti/build/git/git
eaugusti@csclnx03:~$ ~eaugusti/build/git/git --version
git version 2.8.0.rc2
To use the new version of git by default, you can add it to your path. To do this, edit the .mybashrc file located in your home directory. (Note that this file is hidden by default, use ls -a to view hidden files.) Add the following lines to the bottom:
PATH=~eaugusti/build/git:$PATH
export PATH
Afterwards, you need to run the bash command to reload your settings.
eaugusti@csclnx03:~$ bash
To check to make sure you are using the new version, do git --version
eaugusti@csclnx03:~$ ~eaugusti/build/git/git --version
git version 2.8.0.rc2