Skip to main content
CalcChef

Git Command Builder

Pick a git action such as merge, reset, stash or push, fill in the fields and copy the command, quoted for the shell, with warnings for risky flags. How it works

Use the Git Command Builder

Record staged changes with a descriptive message

About the Git Command Builder

To squash merge a branch, build git merge feature --squash and then commit: git applies the branch changes to your working tree and index and makes no merge commit of its own. The builder writes one git command for 23 actions from the fields you fill in, quotes the values for the shell and never runs git.

The command for each action with its default fields

ActionCommand
initgit init -b main
clonegit clone [url]
addgit add .
commitgit commit -m 'Initial commit'
pushgit push origin main
pullgit pull origin main
checkoutgit checkout main
mergegit merge main
loggit log
stashgit stash push
resetgit reset --mixed
rebasegit rebase -i main
branchgit branch feature-branch
taggit tag -a v1.0.0 -m 'Release v1.0.0' main
diffgit diff
statusgit status
cherry-pickgit cherry-pick
revertgit revert
remotegit remote add origin
refloggit reflog
blamegit blame -- [file]
bisectgit bisect start
abort / continuegit merge --abort

What the builder writes for each action before you change a field. clone shows [url] until you enter the repository address, blame shows [file] until you enter a file, remote add warns until you enter the URL, and cherry-pick and revert warn until you enter a commit. Abort / continue starts on git merge --abort; its list also has merge --continue, rebase --abort, --continue and --skip, and cherry-pick and revert --abort and --continue.

How to use this tool

  1. Pick the action: init, clone, add, commit, push, pull, checkout, merge, log, stash, reset, rebase, branch, tag, diff, status, cherry-pick, revert, remote, reflog, blame, bisect, or abort / continue for a merge, rebase, cherry-pick or revert that stopped on a conflict.
  2. Fill in the fields that appear, such as the message, branch or reference, and tick the flags you want.
  3. Read any warning under the command, and the Way back line after a reset --hard, branch -D, rebase or amend, then press Copy and paste the command into your terminal.

Frequently asked questions

How do I squash merge a branch?
Choose Merge, enter the branch and tick Squash. For a branch called feature the command is git merge feature --squash. Git stages the changes and stops, so run git commit afterwards to record them as one ordinary commit. Git refuses --squash together with --no-ff, so the builder clears one when you tick the other; No Fast-Forward alone gives git merge feature --no-ff.
How do I find the commit that introduced a bug?
Choose Bisect. Run git bisect start, then git bisect bad (empty means the commit you are on) and git bisect good v1.2.0 for a version without the bug. Git checks out a commit halfway between; test it and mark it good or bad, or git bisect skip if it cannot be tested, until git names the first bad commit. git bisect reset returns you to where you started.
How do I undo the last commit but keep my changes?
Use Reset with --soft or --mixed and HEAD~1. --soft keeps the changes staged and --mixed, the default, keeps them in the working tree unstaged. --hard moves HEAD and also discards working-tree changes, so use it with care. After a --hard reset the builder shows the way back: git reflog lists where HEAD pointed, and git reset --hard with the old hash restores those commits. Changes that were never committed are not in the reflog.
How do I drop a stash?
Choose Stash, set the action to drop and enter the reference. For stash@{0} the command is git stash drop 'stash@{0}'. The builder single-quotes any value with characters outside a plain set, which is correct in every POSIX shell; bash and zsh would also accept stash@{0} unquoted, but PowerShell would not. Leave the reference empty to drop the latest stash.
What does git rebase -i do?
The default Rebase command is git rebase -i main. It opens your editor with one pick line for each commit that is about to be replayed onto main; change pick to reword, edit, squash or drop, or reorder the lines, then save and close. Those commits are rewritten, so do not rebase a branch others have based work on. Set Rebase Mode to Standard for git rebase main, which replays the commits without the list.
How do I undo a commit that is already pushed?
Choose Revert and enter the commit: git revert a1b2c3d makes a new commit that undoes it, so the shared history is not rewritten, unlike a reset. To revert a merge commit, git needs the parent to keep, given with -m: parent 1 with the default message gives git revert -m 1 --no-edit HEAD. Tick Do not commit (-n) to stage the undo without committing it.

Related Tools

View all tools