#-#
#-# Configuration
#-#
Define the author name to be used for all commits by the current user.
git config –global user.name
Define the author email to be used for all commits by the current user.
git config –global user.email
Create shortcut for a Git command.
E.g. alias.glog “log –graph –oneline” will set “git glog” equivalent to “git log –graph –oneline”
git config –global alias.
Set text editor used by commands for all users on the machine.
The arg should be the command that launches the desired editor (ex. vim).
git config –system core.editor
Open the global configuration file in a text editor for manual editing.
git config –global –edit
Enable helpful colorization of command line output
git config –global color.ui auto
List all configured properties
git config –list
#-#
#-# Command line
#-#
#-# Get and create repositories
Command Description
git clone
git init
#-# Basic snapshotting
Command Description
git status Show changed files in your working directory.
git diff Show changes to tracked files.
git diff –cached Show staged changes.
git add . Stage all changes to the next commit.
git add
git commit -am ‘
git commit -m ‘
git commit –amend Combine the staged changes with the last commit.
#-# Reset & Revert
Command Description
git checkout HEAD
git revert
git reset –hard HEAD Discard all local changes in your working directory.
git reset –hard
git reset
git reset –keep
git rm
git rm –cached
git mv
#-# Remote
Command Description
git remote update Refresh list of remotes.
git remote -v List all currently configured remotes.
git remote show
git remote add
git fetch
git pull
git push
git push
git push –tags Publish tags.
#-# Braches & Tags
Command Description
git branch List local branches.
git branch -a List both local and remote branches.
git branch -r List remote branches.
git checkout
git branch
git branch -d
git tag
#-# Merge & Rebase
Command Description
git merge
git rebase
git rebase –abort Abort a rebase.
git rebase –continue Continue a rebase after resolving conflicts.
git mergetool Use configured merge tool to resolve conflicts.
#-# Stash
Command Description
git stash Temporarily store all modified tracked files.
git stash save [msg] Same as above but naming the stash entry.
git stash pop Restore most recently stashed files.
git stash list List all stashed changes.
git stash drop Discard most recently stashed changeset.
#-# Review history
Command Description
git log Show all commits, starting with most recent.
git log
git log –follow
git blame