Git Commands Cheatsheet
Free Git commands cheatsheet. Categorized reference with descriptions, examples, and common workflows.
Setup & Config
git initInitialize a new repository
git clone <url>Clone a repository
Example: git clone https://github.com/user/repo.git
git config --global user.name <name>Set global username
Example: git config --global user.name "John Doe"
git config --global user.email <email>Set global email
Example: git config --global user.email "john@example.com"
git config --listList all config settings
Basic Snapshotting
git statusShow working tree status
git add <file>Stage a file
Example: git add index.html
git add .Stage all changes
git commit -m <msg>Commit staged changes
Example: git commit -m "Add feature"
git commit --amendAmend the last commit
git diffShow unstaged changes
git diff --stagedShow staged changes
git reset <file>Unstage a file
git rm <file>Remove a file from tracking
git mv <old> <new>Rename/move a file
Branching & Merging
git branchList branches
git branch <name>Create a new branch
Example: git branch feature/login
git branch -d <name>Delete a branch
git checkout <branch>Switch to branch
git checkout -b <branch>Create and switch to branch
git switch <branch>Switch to branch (modern)
git switch -c <branch>Create and switch (modern)
git merge <branch>Merge branch into current
git rebase <branch>Rebase current onto branch
git cherry-pick <hash>Apply a specific commit
Remote
git remote -vList remotes with URLs
git remote add <name> <url>Add a remote
Example: git remote add origin https://github.com/user/repo.git
git fetchDownload remote changes
git pullFetch and merge remote changes
git pushPush commits to remote
git push -u origin <branch>Push and set upstream
git push --forceForce push (use with caution!)
History & Inspection
git logShow commit history
git log --onelineCompact log
git log --graphShow branch graph
git show <hash>Show commit details
git blame <file>Show who changed each line
git reflogShow reference log
Stashing
git stashStash current changes
git stash popApply and remove latest stash
git stash listList all stashes
git stash applyApply latest stash (keep it)
git stash dropRemove latest stash
git stash clearRemove all stashes
Undoing Changes
git restore <file>Discard working directory changes
git restore --staged <file>Unstage a file
git reset --soft HEAD~1Undo last commit, keep changes staged
git reset --mixed HEAD~1Undo last commit, keep changes unstaged
git reset --hard HEAD~1Undo last commit, discard changes
git revert <hash>Create a commit that undoes a commit
Tags
git tagList tags
git tag <name>Create lightweight tag
Example: git tag v1.0.0
git tag -a <name> -m <msg>Create annotated tag
git push --tagsPush all tags to remote
What is it?
Git Commands Cheatsheet is a free online tool that runs entirely in your browser. Free Git commands cheatsheet. Categorized reference with descriptions, examples, and common workflows. No data is sent to any server — all processing happens locally on your device, ensuring complete privacy and security. Whether you're a developer, designer, student, or professional, this tool saves you time by providing instant results without requiring any software installation or account creation.
How to use
Using Git Commands Cheatsheet is straightforward. Simply enter or paste your data in the input field, configure any available options, and click the action button to process. The result appears instantly in the output area. You can copy the result to your clipboard with one click. If you need to start over, just clear the input and try again. The tool accepts a wide range of inputs and handles edge cases gracefully.
When to use
Git Commands Cheatsheet is useful in many everyday scenarios. Developers use it during coding sessions to quickly process data without leaving the browser. It's also perfect for one-off tasks where installing a dedicated application would be overkill. Students and learners find it helpful for understanding how the underlying process works. Since it's web-based, you can use it from any device — desktop, laptop, tablet, or phone — without any setup.