Learning Git

Getting up to speed

Thomas's favorite place to start is with the Git Parable, which explains what Git is actually doing. Once you have this mental model of what's going on, you can learn the commands that manipulate this model.

Collaborative GitHub Workflow describes the common command line operations you'll use for interacting with GitHub, and the workflow that we use for exchanging information.

Git Magic seems like a very friendly online book

Pro Git is a short-ish online book that does a really good job of explaining the command line operations, and many useful details. I think that reading chapters 1, 2, 3, 5, and 6 is quite useful.

Reference

You can always get help using git help. That gives a list of common commands. You can get help with particular commands with git help command-name, for example git help pull. In Windows, this opens up a nice version of the help file, in your web browser. Cool!

Git cheat sheet

If you abhor the commandline, there is a tutorial for getting egit working with ssh and github.

Proverbs

(add more if you want!)

By default, when you clone a GitHub repository using Eclipse, it puts the clone in ~/git. So Thomas's copy of CIShell is at C:\Users\thgsmith\git\CIShell. This is a plain old git repository, so you can use the git command line tools on it, and Eclipse will notice what you are doing. If Eclipse doesn't notice, you may have to select the projects you've modified and press F5 to have it "refresh."

"Git Bash" is great! On windows, it's in the start menu if you did a full install of Msys-git, or in the bin/ directory of your 'portable git'. In it, try cd ~/git to find Eclipse's (default) place for stashing git things.

git revert doesn't mean what you think it does! The equivalent of svn revert is either git reset or git checkout -- filename, read git help reset before you use it. More on git reset and checkout

git checkout -b new-branch-name is a good way to start a "feature branch".

You should have a git remote configured for the "master" cishell repository: "git remote add cishell git://github.com/CIShell/CIShell.git". You can also add all the other developers' repositories, so you can see what they're doing, if you want. You should also have a remote, by convention called "origin", that is YOUR GitHub fork of the cishell repository. This is usually set up automatically when you make a clone of a repository.

Once you have those remotes, you can get a really good overview of what's going on, by saying "git remote update; gitk --all". This will fetch everyone's changes, and show you where your branch heads are (like "master" and "awesomeNewFeature"), where your branch heads are on your GitHub fork (like "remotes/origin/awesomeNewFeature"), and where everyone else's branch heads are (like "remotes/cishell/master").