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
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
| Action | Command |
|---|---|
| init | git init -b main |
| clone | git clone [url] |
| add | git add . |
| commit | git commit -m 'Initial commit' |
| push | git push origin main |
| pull | git pull origin main |
| checkout | git checkout main |
| merge | git merge main |
| log | git log |
| stash | git stash push |
| reset | git reset --mixed |
| rebase | git rebase -i main |
| branch | git branch feature-branch |
| tag | git tag -a v1.0.0 -m 'Release v1.0.0' main |
| diff | git diff |
| status | git status |
| cherry-pick | git cherry-pick |
| revert | git revert |
| remote | git remote add origin |
| reflog | git reflog |
| blame | git blame -- [file] |
| bisect | git bisect start |
| abort / continue | git 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
- 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.
- Fill in the fields that appear, such as the message, branch or reference, and tick the flags you want.
- 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 toolsJSON Formatter
Paste JSON to format it with 2 spaces, 4 spaces or tabs, minify it or sort its keys. A syntax error is reported with its line, column and a caret under it.
JSON Path Query Tool
Test a JSONPath expression on your JSON and see the match count, each matching value and its path. Filters such as ?(@.price < 10) work. Up to 100 KB.
Base64 Converter
Encode text to Base64 or decode Base64 to text. UTF-8, standard and URL-safe alphabets, optional padding on decode, up to 250,000 characters.
URL Encoder/Decoder
Percent-encode or decode text as you type: one value with encodeURIComponent or a whole URL with encodeURI, and an option to read + as a space.
UUID Generator
Generate 1 to 1,000 random v4 UUIDs, or time-based v1, or name-based v5 and v3 from a namespace and a name, and copy them. Repeats of v4 are very unlikely.
ULID Generator
Generate 1 to 500 ULIDs, 26-character IDs that sort by creation time, in upper or lower case, and decode any ULID to the date it was made.