Git Command Generator
Find the right Git command for any task. Searchable reference with examples.
How to use: Pick a Git operation and fill in the details to get the right command.
Initialize a new repository
git initCreates a new .git directory in the current folder.
Clone a repository
git clone <url>Download a remote repository to your local machine.
Stage all changes
git add .Add all modified and new files to staging area.
Commit changes
git commit -m "message"Save staged changes with a descriptive message.
Push to remote
git pushUpload local commits to the remote repository.
Pull from remote
git pullFetch and merge changes from the remote repository.
Check status
git statusShow the working tree status and staged changes.
View commit history
git log --onelineShow compact commit log with one line per commit.
List branches
git branchShow all local branches. Add -a for remote branches.
Create branch
git branch <name>Create a new branch from the current HEAD.
Switch branch
git checkout <branch>Switch to an existing branch.
Create & switch
git checkout -b <branch>Create a new branch and switch to it immediately.
Merge branch
git merge <branch>Merge another branch into the current branch.
Stash changes
git stashTemporarily store modified tracked files.
Apply stash
git stash popRe-apply the most recently stashed changes.
Reset to last commit
git reset --hard HEADDiscard all changes since the last commit.
Revert a commit
git revert <commit>Create a new commit that undoes a previous commit.
View changes
git diffShow unstaged changes in your working directory.
View remotes
git remote -vShow remote repository URLs.
Create tag
git tag <name>Create a lightweight tag at the current commit.
Cherry-pick
git cherry-pick <commit>Apply a specific commit to the current branch.
Rebase
git rebase <branch>Reapply commits on top of another branch.