Not just another git cheat sheet.

Basics

git --versionGet the version of git.
git init <directory>Create empty git repo in specified directory.
git config user.name <name>Define author name to be used for all commits.
git config user.email <email>Define author email to be used for all commits.
git clone <repo>Clone repo located at <repo> onto local machine.
git statusList which files are staged, unstaged and untracked.
git add .Get everything ready to commit.
git add index.htmlGet specific file ready to commit.
git commit -m "message"Commit the staged snapshot.
git logDisplay the entire commit history.
git diffShow all local file changes in the working tree.
git push origin <branch>Push the <branch> to the remote repo.

Branches

git branchList all branches in your repo.
git checkout -b <branch>Create and checkout a new branch named <branch>
git branch -aList remote and local branches.
git checkout <branch>Checkout to an existing <branch>
git push origin <branch>Push the <branch> to the remote repo.
git branch -m <newname>Rename the current branch.
git branch -d <branch>Delete a local <branch>
git merge <branch>Merge <branch> into the current branch.
git merge --abortAbort the merge, in case of conflicts.
git cherry-pick 76ce3e6Merge a specific commit.
git push origin :<branch>Delete a remote <branch>

Logs

git logShow commits.
git log --onelineShow one line summary of commits.
git log -3Show commit history of last three commits.
git log -pShow changes.
git log --graphShow history of commits as graph.
git log --stat --summaryShow stats and summary of commits.
git reflogShow a log of changes to the local repo's HEAD.

Tags

git tagShow all tags.
git tag -a <tagname> -m "message"Create an annotated tag.
git tag <tagname>Create an lightweight tag.
git push --tagsPush all tags to the remote repo.
git show <tagname>Show the tag data of a specific tag.

Stashes

git stash listShow all stashes.
git stash save "stash name" && git stashSave a change to stash.
git stash branch <branch_name>Create branch from stash.
git stash popApply a stash.
git stash clearDeletes complete stash.

Reset

git reset HEAD <file>Remove <file> from staging area.
git resetReset staging area to match the recent commit.
git reset --hardReset staging area, working dir and overwrites all changes.
git clean -dfDelete untracked files and directories.
git clean -fDelete untracked files.

Compare

git diffCompare modified files.
git diff --stagedCompare modified files within the staging area.
git diff <branch>..<branch>Compare two branches.
git diff 76ce3e6..e251d8dCompare two specific commits.