Git runs from the command line, so instead of keyboard shortcuts you get commands. Here are the 40 most people use every week, grouped by what you’re trying to do.
We checked every one against Git reference documentation (git-scm.com) on October 21, 2026.
Setup
| Command | What it does |
|---|---|
| git config –global user.name “Your Name” | Set the name saved with your commits |
| git config –global user.email “[email protected]” | Set the email saved with your commits |
| git config –global –edit | Open your global Git settings in a text editor |
| git init | Create a new repository in the current folder |
| git clone <url> | Copy a remote repository to your computer |
Everyday Changes
| Command | What it does |
|---|---|
| git status | Show changed, staged and untracked files |
| git diff | Show changes you have not staged yet |
| git diff –staged | Show changes that are staged for the next commit |
| git add <file> | Stage one file for the next commit |
| git add . | Stage all changes in the current folder |
| git commit -m “message” | Commit staged changes with a message |
| git commit -am “message” | Stage and commit all changes to tracked files |
| git restore <file> | Throw away unstaged changes to a file |
| git restore –staged <file> | Unstage a file but keep your changes |
| git reset HEAD <file> | Unstage a file (older form of restore –staged) |
| git checkout — <file> | Throw away changes to a file (older form of restore) |
Branches
| Command | What it does |
|---|---|
| git branch | List branches |
| git branch <name> | Create a new branch |
| git branch -d <name> | Delete a branch that has been merged |
| git switch <name> | Switch to another branch |
| git switch -c <name> | Create a new branch and switch to it |
| git checkout <name> | Switch to another branch (older form) |
| git checkout -b <name> | Create and switch to a new branch (older form) |
| git merge <name> | Merge another branch into the current branch |
Remotes
| Command | What it does |
|---|---|
| git remote -v | List remote repositories and their URLs |
| git remote add origin <url> | Add a remote repository named origin |
| git fetch | Download new commits from the remote without merging |
| git pull | Download and merge changes from the remote |
| git pull origin <branch> | Pull one branch from the remote |
| git push | Upload your commits to the remote |
| git push -u origin <branch> | Push a branch and set it to track the remote |
History
| Command | What it does |
|---|---|
| git log | Show the commit history |
| git log –oneline | Show the history one line per commit |
| git show <commit> | Show the changes in one commit |
| git tag <name> | Tag the current commit, for example v1.0 |
Undo and Stash
| Command | What it does |
|---|---|
| git stash | Set aside uncommitted changes for later |
| git stash pop | Bring back the most recently stashed changes |
| git revert <commit> | Make a new commit that undoes an earlier commit |
| git reset –hard <commit> | Move back to a commit and throw away later changes |
| git clean -fd | Delete untracked files and folders |
Good to know: These are commands you type in a terminal (Command Prompt, PowerShell or Git Bash), not hotkeys. Replace anything in <angle brackets> with your own value.
Good to know: git reset –hard and git clean -fd delete work for good. Run git status first.
Get the Excel and PDF Version
Everything above is free. Bookmark this page and use it anytime.
If you’d rather have it on your desk, the download below is a sortable Excel file plus a printable one-page PDF of all 40 commands, for $0.99.
Want One Key to Do More?
Typing the same Git commands over and over? These tools let you fire them with a hotkey you pick:
- Prompt Assistant: type a short abbreviation like ;gac and have it expand to a full git add and commit command in your terminal
- Windows 11 Power User Tools: more tools for people who work in the terminal all day

