We're switching to git (on github.com) at the moment, and I really wanted to use it properly instead of just relying on the GIU clients. I decided to learn it using the command-line, and I found this excellent tutorial online which really helped me understand some of the fundamentals: http://www.sbf5.com/~cduan/technical/git/.
This article contains my basic cheat sheet for Git, which more or less follows the general workflow when using a git repo.
|Initialises a new git repository in the current folder.|
|Clones and initialises a remote git repository locally in the current folder - adds a remote repository reference named "origin".|
|View log changes.|
|Recursively adds all changes to the repository.|
|See what changes will be committed before actually running git commit.|
|Commits changes to the repository.|
|Get a list of local branches, with a star next to the current head.|
|Creates a new branch based on an existing branch e.g. |
|Switches to a new branch and updates the local folder with the files from that branch.|
|Retrieves remote changes and updates remote heads.|
|Pulls all remote changes (origin can be replaced with a URL, for example).|
|Pulls all remote changes but baselines them BEFORE your local changes, so your changes move on top of what everybody else has already contributed.|
|Pushes all changes back to the repository origin.|
|Clone a specific tag from a remote repo.|
|Moves MyFolder into SubFolder.|
Edit (30 June 2015): To prevent yourself from having to enter credentials with each command-line entry, you can configure it to use a local store with the following command:
git config credential.helper store - this will result in one request for user credentials and then no more.