Git Links and "Cheat Sheet"
All written work products for the projects in this course should
be maintained on GitHub. Git seems to be the dominant
open source distributed version control system, and
GitHub offers free accounts
and a good set of tutorials.
There are a few steps you will have to follow, but they are not difficult:
-
Each student will need to
Create a GitHub account
, which is free, fast and easy.
-
Each student will need to
download, install, and configure
the Git software.
If you get tired of entering your password, you can generate
and up-load an
ssh key to GitHub.
-
One member of each team will need to
create a repository
for each project.
-
The simplest collaboration model is for the repository owner
to add the other team members as
collaborators in that repository. Once this has been done, all
of the team members will be able to directly push
updates back to the project repository.
But, if you are feeling frisky a little later in the semester,
and want to see learn how the big kids do it, you can try
managing your project repo with
forks and pull requests.
You will probably want to do some background reading on git.
At the very least you should read:
Before too long you will probably also want to read:
And you can use Git in anger you will need to understand branches:
Cheat Sheet
To get you started, these are the commands you will use most often:
-
git clone git@github.com:username/repository.git
Create a local copy of the specified repository (owned by the specified user).
By default it will be created in the current working directory with the
same name it has on GitHub, but you can specify the name that the local
directory should be given.
-
git status
List all of the differences (both un-tracked, and uncommitted)
between the current workspace and the
committed state of the repository from which it came.
-
git add file ...
Note that the specified files have been created or changed, and should
be included in the next commit.
-
git diff file
Display a list of the differences between the specified file in the
current workspace and the last committed version.
-
git rm file ...
Note that the specified files have are being deleted and should no longer
be included in the repository.
-
git commit -m "comments" file
Commit all of the staged changes, and associate the specified comment
with this commit.
Note that this change has only been made to the local
repository, and has not yet been pushed back to GitHub.
-
git log file
Display the commit history for the specified file.
-
git tag -a tagname -m "description"
associate the specified tagname and description
with the currently committed versions.
-
git pull
Go back to the repository from which this local copy was cloned,
obtain all of the recent changes that have been made there, and
merge those changes into the local copy.
If you want to get fancy (e.g. and review the changes before you
try to merge them) you can do this in separate fetch
and merge operations. Note, however, that as soon
as you start having conflicting updates
you are not in Kansas any more, and it is time to
truly understand branching, merging, rebasing, and distributed work flows.
-
git push origin master
Take all of the changes that have been made in the local copy, and
send them back to the master copy on GitHub. Note that this operation
will fail if there are changes on the master copy that have not yet
been merged into the local copy (this is a safety feature).