Git Cheat Sheet
Transform, format, and optimize your data instantly with this free client-side tool.
Setup & Config
Set global username
Set global email
List all Git configurations
Initialize a new Git repository
Clone an existing repository
Basic Snapshot
Show modified files in working directory
Add file to staging area
Add all current changes to staging area
Commit staged changes
Add all tracked files and commit
Show unstaged changes
Show staged changes
Discard changes in working directory
Branching & Merging
List all local branches
List local and remote branches
Create new branch
Switch to branch
Create new branch and switch to it
Merge <branch> into current branch
Delete local branch
Force delete local branch
Sharing & Updating
Add remote repository
List remote connections
Fetch remote history (does not merge)
Fetch and merge remote changes
Push local commits to remote branch
Push and set upstream tracking
Delete remote branch
Inspection & Comparison
Show commit history
Show condensed history
Show history with branch graph
Show metadata and content changes of commit
Show who changed what and when in a file
Undoing Changes
Create a new commit undoing changes from a previous commit
Undo last commit, keep changes staged
Undo last commit and DISCARD all changes
Dry run: show untracked files to be removed
Remove untracked files and directories
Stashing
Temporarily store modified, tracked files
Stash changes with a message
List all stashes
Restore most recent stash (keep in list)
Restore and remove most recent stash
Delete most recent stash
Advanced
Reapply commits on top of another base tip
Interactive rebase (squash, edit, reorder commits)
Apply changes from specific commit to current branch
Start binary search to find bug-introducing commit
Create a lightweight tag
Push all tags to remote
View local history of HEAD to recover lost commits
Add staged changes to the last commit without changing message
🔥 Similar Tools
Explore LibraryFrequently Asked Questions
Got questions? We've got answers.