Skip to main content

git

Quick reference for git commands.

Commands

  • 📄 means the command is built-in.
  • ✚ means the command is available from tj/git-extras.
  • ⛓️ means the command is available from nvie/git-toolbelt.
SubcommandDocsDescription
abortAbort a revert, rebase, merge or cherry-pick
aliasDefine, search and show aliases
archive-fileZip the repository
authorsGenerate an AUTHORS file
browseOpen the repository in the browser
browse-ciOpen the CI pipeline in the browser
brvPretty-print branches with their last commit
changelogGenerate a HISTORY/CHANGE file content
clearClear unstage changes and remove untracked files (includes ignored files)
clear-softClear unstage changes and remove untracked files (excludes ignored files)
countCount the number of commits
extrasShow the man page of git-extras
forkFork and clone a repository
ignoreShow ignored patterns
ignore-ioGenerate .gitignore from gitignore.io
lockLock a file from being changed in the repository
lockedList all locked files
obliterateRemove a file from the entire history of a git repository
root⛓️Show the root directory of the repository
summaryShow commit summary
show-treeShow commit tree
standupShow a user's contributions in the past n days
unlockUnlock a file from being changed in the repository

Snippets

Stage case-sensitive file changes

git mv --force old_name NEW_NAME

Remove commits after a certain commit

git rebase --committer-date-is-author-date -i <commit-hash>^