Command Index¶
Every Git command used across this folder, in one alphabetical list, with a one-line reminder of what it does and the topic that covers it. Use it to jump from a half-remembered name to the page that explains the flags. Plumbing commands are marked; the rest are everyday porcelain.
A to C¶
| Command | Does | Topic |
|---|---|---|
git add | Stage changes; -p stages selected hunks | Staging and Committing |
git bisect | Binary-search history for the first bad commit | Bisect |
git blame | Show who last changed each line | Inspecting History |
git branch | List, create, delete or rename branches | Branches |
git cat-file (plumbing) | Print an object's type, size or content | Object Model |
git cherry-pick | Apply a specific commit onto the current branch | Cherry-Pick |
git clean | Delete untracked files and directories | Undoing Changes |
git clone | Copy a remote repository locally | Remotes |
git commit | Record staged changes; --amend rewrites the last | Staging and Committing |
git config | Read and write configuration at a level | Install and Config |
D to H¶
| Command | Does | Topic |
|---|---|---|
git describe | Name a commit by the nearest tag plus distance | Tags and Releases |
git diff | Show changes between trees, index or commits | Inspecting History |
git fetch | Download refs and objects, changing no branch | Remotes |
git filter-repo (external) | Rewrite history to remove files or strings | Filter-Repo and Secrets |
git fsck | Verify object integrity, find dangling objects | Packfiles and GC |
git gc | Repack objects and prune unreachable ones | Packfiles and GC |
git hash-object (plumbing) | Compute or write an object's SHA | Object Model |
I to M¶
| Command | Does | Topic |
|---|---|---|
git init | Create a new repository | What Is Git |
git log | Show commit history with many formats | Inspecting History |
git ls-files (plumbing) | List tracked files and their index modes | Submodules |
git ls-tree (plumbing) | List a tree object's entries | Object Model |
git maintenance | Schedule background upkeep of a repo | Large Repos |
git merge | Join two branches into one | Merging |
git merge-base (plumbing) | Find the common ancestor of two commits | How Merge and Rebase Work |
git mv | Move or rename a tracked file | Staging and Committing |
N to R¶
| Command | Does | Topic |
|---|---|---|
git pull | Fetch then merge (or rebase) the upstream | Pushing and Pulling |
git push | Send commits to a remote; --force-with-lease safely | Pushing and Pulling |
git rebase | Replay commits onto a new base; -i to reshape | Rebasing |
git reflog | Show every move of HEAD, to recover lost commits | Reflog and Recovery |
git remote | List and manage remotes | Remotes |
git reset | Move the branch; --soft/--mixed/--hard | Undoing Changes |
git restore | Discard working-tree or unstage changes | Undoing Changes |
git revert | Add a commit that inverts an earlier one | Undoing Changes |
git rev-list (plumbing) | List commit or object SHAs for scripting | Bloated Repo, Large File |
git rev-parse (plumbing) | Resolve a name to a SHA or repo fact | Refs and HEAD |
git rm | Remove a tracked file and stage the removal | Undoing Changes |
S to Z¶
| Command | Does | Topic |
|---|---|---|
git show | Show a commit, tag or object with its diff | Inspecting History |
git sparse-checkout | Materialize only chosen paths in the working tree | Large Repos |
git stash | Shelve working-tree changes for later | Stashing |
git status | Show staged, modified and untracked state | Staging and Committing |
git submodule | Manage embedded repositories (gitlinks) | Submodules |
git switch | Change branch; -c creates, --detach detaches | Branches |
git tag | Create and list tags, lightweight or annotated | Tags and Releases |
git update-ref (plumbing) | Create or move a ref directly | Refs and HEAD |
git worktree | Attach extra working directories to one repo | Worktrees |
Related¶
- Cheatsheet: the same commands grouped by task
- Config Reference: the keys
git configsets - Glossary: the objects and terms these commands act on
- Error Messages: what to do when one of these fails