git notes

You may want to checkout this video before next week.

You do not have to do any of the git configuration before our Feb. 10th Meeting. I'll cover it in class then.

Jeet pointed me to this nice online book on git.
It is a complicated but powerful tool. Don't worry we are only going to cover the basics

Download a repository

To get a local copy of remote repository, you "clone" it.

git clone git@github.com:mtholder/eebprogramming.git

This will created a subdirectory on your maching called eebprogramming that has the repository.

Get the latest version of a repository

To update a repository that you have downloaded, cd into it and pull the changes:

cd eebprogramming.git
git pull origin

To create your own repository

If you want to start a new repository (not just add files to an existing repo), then use

git init

Then to associate your local repository with a remote location you'll use a
git remote add origin <github repository location here>

where the github repository location is provided to you when you create a new repository on GitHub.

To publish your changes so that other people can see them

Whenever you finish a logical chunk of coding you should commit the changes.

If you have added a new file that git did not manage before, then you have to add it before committing.

Let's say that you have just created a new file called "assignment1.py" in your repository which is called "myrepo":

cd myrepo
git add assignment1.py
git commit -m "Added a script for the first assignment" -a

If you forget the commit message (the -m argument followed by a quoted string), then git will send you into a text editor.
On most UNIX-like machines (including Mac) this will be vi.
To exit vi, you execute the following cryptic command with a return at the end

:q!

Now the git repository on your machine will save the version as a commit.
When you "push" your changes, then git will transfer your commits to the public server so that other people can pull them down.

cd myrepo
git push origin master