// Dictionary
The Fucking Git Dictionary
Git commands, translated into what they really mean.
| Command | Translation | What it actually does |
|---|---|---|
| git init | The beginning of all your problems.Creates a new Git repository in the current folder. | Creates a new Git repository in the current folder. |
| git clone | Adopt someone else's problems.Downloads a repository and its whole history. | Downloads a repository and its whole history. |
| git status | Ask Git how bad it is.Shows changed, staged and untracked files. | Shows changed, staged and untracked files. |
| git add . | Everything. Even what you shouldn't.Stages every change in the current folder for the next commit. | Stages every change in the current folder for the next commit. |
| git push | Send your work out into the world.Uploads your local commits to the remote branch. | Uploads your local commits to the remote branch. |
| git push --force | Gamble with your career.Replaces the remote branch with yours, whatever is on it. | Replaces the remote branch with yours, whatever is on it. |
| git reset --hard | Make your problems disappear. And your work.Moves the branch and overwrites the working directory. | Moves the branch and overwrites the working directory. |
| git stash | Sweep your problems under the rug.Saves uncommitted changes aside and cleans the working directory. | Saves uncommitted changes aside and cleans the working directory. |
| git reflog | Your last hope.Journal of every position HEAD went through. | Journal of every position HEAD went through. |
| git cherry-pick | Steal a commit with elegance.Applies the changes of a given commit on the current branch. | Applies the changes of a given commit on the current branch. |
| git blame | Find someone to blame. Find yourself.Shows who last modified each line of a file. | Shows who last modified each line of a file. |
| git commit -m "fix" | Lie to your future self.Records staged changes with a (very unhelpful) message. | Records staged changes with a (very unhelpful) message. |
| git rebase -i | Rewrite history like a dictator.Reorder, squash, edit or drop commits interactively. | Reorder, squash, edit or drop commits interactively. |
| git merge | Marry two branches. Expect arguments.Joins the history of another branch into the current one. | Joins the history of another branch into the current one. |
| git bisect | Detective mode: find the guilty commit.Binary search through history to find the commit that introduced a bug. | Binary search through history to find the commit that introduced a bug. |
| git clean -fd | Marie Kondo, but irreversible.Deletes all untracked files and folders. | Deletes all untracked files and folders. |
| git pull | Open the box of surprises your colleagues left you.Fetches remote changes and merges them into your branch. | Fetches remote changes and merges them into your branch. |
| git checkout . | Ctrl+Z on your entire afternoon.Discards every uncommitted change in the current folder. | Discards every uncommitted change in the current folder. |
| git commit --amend | Pretend it never happened.Replaces the last commit with a new one. | Replaces the last commit with a new one. |
| git log | Read the diary of your mistakes.Lists the commit history. | Lists the commit history. |
| git fetch | Look at the disaster without touching it.Downloads remote commits without changing your branches or files. | Downloads remote commits without changing your branches or files. |
| git diff | Spot the 7 differences. There are 412.Shows line-by-line changes not yet staged. | Shows line-by-line changes not yet staged. |
| git revert | Apologise publicly, in writing.Creates a new commit that undoes an old one, without rewriting history. | Creates a new commit that undoes an old one, without rewriting history. |
| git switch | Change worlds. Hopefully with your work saved.Moves to another branch (the modern half of git checkout). | Moves to another branch (the modern half of git checkout). |
| git restore | Ctrl+Z, but for one file.Restores files in the working directory or the index (the other half of git checkout). | Restores files in the working directory or the index (the other half of git checkout). |
| git tag | Carve a date on the tree. Never move it.Gives a permanent name to a commit, usually a version number. | Gives a permanent name to a commit, usually a version number. |
| git remote | The list of places where your mistakes get published.Manages the remote repositories (origin, upstream…). | Manages the remote repositories (origin, upstream…). |
| git config | Tell Git who to blame.Reads and writes settings: identity, aliases, behaviour. | Reads and writes settings: identity, aliases, behaviour. |
| git worktree | Be in two places at once. Legally.Checks out another branch in a second folder of the same repository. | Checks out another branch in a second folder of the same repository. |
| git submodule | A repository inside a repository. Inception.Includes another repository at a fixed commit. | Includes another repository at a fixed commit. |
| git rm --cached | Pretend you never met.Stops tracking a file but keeps it on disk. | Stops tracking a file but keeps it on disk. |
| git gc | Take out the trash. Including what you wanted to recover.Compresses the repository and removes unreachable objects after a delay. | Compresses the repository and removes unreachable objects after a delay. |
| git rerere | Déjà vu, but useful.Remembers how you resolved a conflict and replays the resolution. | Remembers how you resolved a conflict and replays the resolution. |
| git lfs | A storage room for your oversized files.Stores big files outside the repository, with pointers inside. | Stores big files outside the repository, with pointers inside. |
| git switch - | Undo my last life choice.Goes back to the branch you were on before. | Goes back to the branch you were on before. |
| git restore --staged | Actually, not that one.Removes a file from the index; the changes stay on disk. | Removes a file from the index; the changes stay on disk. |
| git stash pop | Bring back what I hid, and hope.Applies the latest stash and deletes it (kept if there is a conflict). | Applies the latest stash and deletes it (kept if there is a conflict). |
| git reset --soft HEAD~1 | I didn't mean to commit. Yet.Undoes the last commit and keeps its changes staged. | Undoes the last commit and keeps its changes staged. |
| git branch -D | Delete it. I said DELETE IT.Deletes a local branch even if its work isn't merged anywhere. | Deletes a local branch even if its work isn't merged anywhere. |
| git push --force-with-lease | Force, but politely.Force push that refuses to overwrite commits you haven't seen. | Force push that refuses to overwrite commits you haven't seen. |
| git commit --fixup | A patch for my patch.Creates a commit marked to be merged into another one by rebase --autosquash. | Creates a commit marked to be merged into another one by rebase --autosquash. |
| git merge --abort | Pretend this merge never happened.Stops a merge with conflicts and goes back to the state before it. | Stops a merge with conflicts and goes back to the state before it. |
| git rebase --abort | Ctrl+Z for a rebase.Cancels a rebase in progress and restores the branch as it was. | Cancels a rebase in progress and restores the branch as it was. |
| git log --oneline | The history, in tweet format.One line per commit: short hash and message. | One line per commit: short hash and message. |
| git shortlog -sn | The leaderboard.Number of commits per author. | Number of commits per author. |
| git fsck | Git's medical check-up.Checks the object database and lists lost commits. | Checks the object database and lists lost commits. |
| git sparse-checkout | I only want my corner of the monorepo.Checks out only the folders you choose. | Checks out only the folders you choose. |
| git describe | Which version am I, really?Names a commit from the nearest tag (v1.2.0-3-gabc123). | Names a commit from the nearest tag (v1.2.0-3-gabc123). |
| git archive | Zip it, without the .git.Creates a zip/tar of a commit's files, without the history. | Creates a zip/tar of a commit's files, without the history. |
| gh pr create | Please accept my code. I'm begging.Opens a pull request from the current branch (GitHub CLI). | Opens a pull request from the current branch (GitHub CLI). |
| gh pr checkout | Let me see your mess up close.Downloads a pull request's branch and switches to it. | Downloads a pull request's branch and switches to it. |
| gh pr merge --squash | 47 commits enter, 1 comes out.Merges the PR as a single commit on the base branch. | Merges the PR as a single commit on the base branch. |
| git request-pull | A pull request, the 2005 way.Generates a text summary asking someone to pull your branch (the email ancestor of PRs). | Generates a text summary asking someone to pull your branch (the email ancestor of PRs). |
| git range-diff | Spot the difference, rebase edition.Compares two versions of a series of commits, e.g. a PR before and after a force push. | Compares two versions of a series of commits, e.g. a PR before and after a force push. |
| git merge --squash | Hide the drafts, keep the result.Brings a branch's changes as one uncommitted change, to commit as a single commit. | Brings a branch's changes as one uncommitted change, to commit as a single commit. |