Leaderboard ad · 728×90
Git Cheatsheet
Common Git commands by category. Copy commands with one click and filter via search.
61 entries matched
Configuration & init5
git config --global user.name "Your Name"Set global usernamegit config --global user.email "[email protected]"Set global emailgit config --global --listList global configurationgit config --global init.defaultBranch mainSet the default branch namegit initInitialize a new repository hereDaily changes13
git statusShow working tree statusgit status -sShow status in short formatgit add <file>Stage a filegit add .Stage all changesgit commit -m "message"Commit staged changesgit commit -am "message"Stage tracked files and commitgit commit --amendAmend the last commitgit diffShow unstaged changesgit diff --stagedShow staged changesgit rm <file>Remove a file and stage the deletiongit mv <old> <new>Move or rename a filegit restore <file>Discard working tree changesgit restore --staged <file>Unstage a file, keep changesBranches11
git branchList local branchesgit branch <name>Create a new branchgit checkout <branch>Switch to a branchgit checkout -b <branch>Create and switch to a branchgit switch <branch>Switch to a branch (modern)git switch -c <branch>Create and switch to a branch (modern)git merge <branch>Merge a branch into the current onegit merge --abortAbort a merge in progressgit rebase <branch>Rebase the current branch onto anothergit branch -d <branch>Delete a merged branchgit branch -D <branch>Force delete a branchRemotes11
git clone <url>Clone a remote repositorygit remote add origin <url>Add a remote named origingit remote -vList remotesgit fetchFetch remote updates without merginggit fetch --pruneFetch and prune deleted remote branchesgit pullFetch and merge remote changesgit pull --rebaseFetch and rebase remote changesgit push origin <branch>Push a branch to the remotegit push -u origin <branch>Push and set upstream trackinggit push --force-with-leaseForce push with a safety checkgit push origin --delete <branch>Delete a remote branchHistory & undo13
git logShow commit historygit log --oneline --graphCompact graphical historygit show <commit>Show details of a commitgit blame <file>Show who last changed each linegit reflogShow the local reference loggit reset --soft HEAD~1Undo the last commit, keep changesgit reset --hard HEAD~1Undo the last commit, discard changesgit reset --hard <commit>Hard reset to a specific commitgit revert <commit>Revert a commit with a new commitgit stashStash current changesgit stash listList stashesgit stash popApply and drop the latest stashgit cherry-pick <commit>Apply a single commit to the current branchTags8
git tagList all tagsgit tag v1.0.0Create a lightweight taggit tag -a v1.0.0 -m "release"Create an annotated taggit show v1.0.0Show tag detailsgit push origin v1.0.0Push a tag to the remotegit push --tagsPush all tagsgit tag -d v1.0.0Delete a local taggit push origin :refs/tags/v1.0.0Delete a remote tagIn-content ad · responsive
Related Tools
My Browser Info
See your User-Agent, screen, CPU cores, timezone and other browser details.
World Clock
Live current time for major cities worldwide on one screen.
Time Zone Converter
Convert time between two cities for meetings across time zones.
Keyboard Keycode
Press any key to see its key name, code and keyCode for development.
Unicode Converter
Convert text to and from \u, U+ and HTML numeric Unicode formats.
Base Converter
Convert between binary, octal, decimal, hex and any base 2-36.