Tools

Git Command Cheat-Sheet

Quick-reference cheat sheet for common Git commands: configuration, branching, commits, remotes, merge, rebase, and more.

CommandDescription
git config --global user.name "Your Name"Set your Git global username.
git config --global user.email "[email protected]"Set your Git global email.
git initInitialize a new Git repository.
git clone <repository>Clone a repository into a new directory.
git statusShow the working directory status.
git add <file>Stage file(s) for commit.
git commit -m "message"Commit staged changes with a message.
git logShow commit logs.
git diffShow changes between commits, commit and working tree, etc.
git branchList, create, or delete branches.
git checkout <branch>Switch to a branch and update the working directory.
git checkout -b <branch>Create and switch to a new branch.
git merge <branch>Merge specified branch into current branch.
git rebase <branch>Reapply commits on top of another base tip.
git fetchDownload objects and refs from another repository.
git pullFetch from and integrate with another repository or branch.
git pushUpdate remote refs along with associated objects.
git remote -vList remote repositories.
git reset --hard <commit>Reset current HEAD to the specified state, discarding changes.
git revert <commit>Revert changes from a commit by creating a new commit.
git stashStash changes in a dirty working directory.
git stash popApply the top stash and remove it from the stash list.
git tag <tagname>Create a tag object.
git branch -d <branch>Delete a branch.