Git Command Cheatsheet
Searchable reference for common Git commands.
34 of 34 commands
Setup
git initCreate a new empty repository in the current directory.
git clone <url>Copy an existing repository to your local machine.
git config --global user.name "name"Set the name used in your commits.
Basics
git statusShow changed, staged, and untracked files.
git add <file>Stage a file's changes for the next commit.
git add .Stage all changes in the current directory.
git commit -m "message"Record staged changes with a message.
git commit --amendEdit the most recent commit instead of creating a new one.
git diffShow unstaged changes compared to the last commit.
git diff --stagedShow staged changes compared to the last commit.
History
git logShow commit history for the current branch.
git log --oneline --graphShow a compact, graph-style commit history.
git show <commit>Show the changes introduced by a specific commit.
git blame <file>Show who last changed each line of a file.
Branching
git branchList local branches.
git branch <name>Create a new branch.
git switch <branch>Switch to an existing branch.
git switch -c <branch>Create a new branch and switch to it.
git merge <branch>Merge another branch into the current branch.
git rebase <branch>Reapply commits on top of another branch.
git branch -d <branch>Delete a local branch (only if merged).
Remote
git fetchDownload commits and branches from a remote without merging.
git pullFetch from a remote and merge into the current branch.
git pushUpload local commits to a remote branch.
git push -u origin <branch>Push a branch and set it to track the remote branch.
git remote -vList remotes and their URLs.
Undo
git reset --soft HEAD~1Undo the last commit but keep changes staged.
git reset --hard HEAD~1Undo the last commit and discard the changes entirely.
git checkout -- <file>Discard local changes to a file.
git revert <commit>Create a new commit that undoes a previous commit.
git stashTemporarily shelve uncommitted changes.
git stash popRe-apply the most recently stashed changes.
Tags
git tag <name>Create a tag at the current commit.
git tag -a <name> -m "message"Create an annotated tag with a message.
What is this tool?
Git Command Cheatsheet is a searchable quick reference for commonly used Git commands. It helps developers quickly find the command and syntax they need without searching through lengthy documentation.
How does it work?
Search the cheatsheet by command, keyword, or task to find relevant Git commands and their descriptions. The reference is available directly in the browser so common Git operations can be looked up quickly.
Key features
- Search common Git commands quickly
- Useful reference for everyday Git workflows
- Find commands by keyword or task
- Helpful for beginners and experienced developers
- Quickly review Git command syntax
- Browser-based reference with no setup required
How to use
- Open the Git Command Cheatsheet.
- Search for a Git command, keyword, or task.
- Review the matching command and its usage.
- Copy the command syntax when needed.
- Clear the search to browse other Git commands.
FAQ
What is Git?
Git is a distributed version control system used to track changes in files and collaborate on software projects.
Who can use this Git cheatsheet?
It is useful for both beginners learning Git and experienced developers who need a quick reference for commonly used commands.
Can I search for a specific Git command?
Yes — use the search feature to find commands by their name, keyword, or the task you want to perform.
Does the cheatsheet run Git commands for me?
No — it is a reference tool that helps you find and understand Git commands. You still need to run the commands in your own terminal or development environment.
