Git Command Generator
A comprehensive git command reference and generator. Filter by category, search by what you want to do, fill in parameters, and copy the ready-to-run command.
git initInitialize a new Git repository in the current directory.
git clone <url>Clone a remote repository into a new local directory.
git statusShow the working tree status — staged, unstaged, and untracked files.
git add .Stage all changed and new files in the current directory.
git add <file>Stage a specific file for the next commit.
git commit -m "<message>"Create a new commit with a message describing the changes.
git log --onelineDisplay the commit history in a compact one-line format.
git diffShow unstaged changes between your working tree and the index.
git diff --stagedShow changes between the index (staged) and the last commit.
git branchList all local branches. The current branch is marked with an asterisk.
git branch <branch>Create a new branch without switching to it.
git checkout <branch>Switch to an existing branch.
git checkout -b <branch>Create a new branch and switch to it immediately.
git switch -c <branch>Create and switch to a new branch (modern alternative to checkout -b).
git merge <branch>Merge the specified branch into the current branch.
git rebase <branch>Reapply commits on top of another branch, creating a linear history.
git branch -d <branch>Delete a local branch (safe — only if fully merged).
git tag <name>Create a lightweight tag at the current commit.
git remote add origin <url>Add a remote named 'origin' pointing to the given URL.
git remote -vList all configured remotes with their fetch and push URLs.
git fetch originDownload objects and refs from the remote without merging.
git pull origin <branch>Fetch and integrate changes from the remote branch.
git push origin <branch>Push the local branch to the remote repository.
git push -u origin <branch>Push and set the upstream tracking so future pushes only need 'git push'.
git cherry-pick <commit>Apply the changes introduced by a specific commit onto the current branch.
git reset --soft HEAD~1Undo the last commit but keep changes staged.
git reset HEAD~1Undo the last commit and unstage changes (default mixed mode).
git reset --hard HEAD~1Undo the last commit and discard all changes permanently.
git revert <commit>Create a new commit that undoes the changes from a specific commit.
git restore <file>Discard changes in the working tree for a specific file.
git restore --staged <file>Unstage a file while keeping the working tree changes.
git commit --amend -m "<message>"Modify the most recent commit message (before pushing).
git stashTemporarily save uncommitted changes to the stash stack.
git stash push -m "<message>"Stash changes with a descriptive message.
git stash listList all stashed changesets.
git stash popApply the most recent stash and remove it from the stash stack.
git stash apply stash@{<index>}Apply a specific stash entry without removing it from the stack.
git stash drop stash@{<index>}Remove a specific stash entry from the stash list.
git log --oneline --graph --allDisplay a visual ASCII graph of the branch history.
git bisect startBegin a binary search to find the commit that introduced a bug.
git blame <file>Show what revision and author last modified each line of a file.
git reflogShow a log of all HEAD movements — useful for recovering lost commits.
git clean -fdRemove untracked files and directories from the working tree.
git submodule add <url> <path>Add another repository as a submodule at the given path.
git worktree add <path> <branch>Check out a branch into a new working tree directory.
How to Use
A comprehensive git command reference and generator. Filter by category, search by what you want to do, fill in parameters, and copy the ready-to-run command.
- 1Use the category tabs at the top to filter commands — choose Basic, Branching, Remote, Undo, Stash, or Advanced, or keep 'All' to see everything.
- 2Type in the search box to filter by command name or description. For example, type 'merge' or 'undo commit' to find relevant commands quickly.
- 3Find the command you need. Each card shows the full command syntax, a description, and a category badge.
- 4If the command has parameters (like <branch> or <message>), fill in the text inputs on the card — the command updates in real time.
- 5Click the 'Copy' button on the card to copy the ready-to-run command to your clipboard, then paste it into your terminal.
Key Features
- 45+ git commands — covering Basic, Branching, Remote, Undo, Stash, and Advanced categories
- Live parameter substitution — fill in branch names, file paths, or commit hashes and copy a ready-to-run command
- Full-text search — find commands by name or description, not just syntax
- Category filtering — focus on just the commands relevant to your current task
- No installation required — runs entirely in your browser, works as a quick reference even without internet