git-toolbelt is a suite of useful Git commands that aid with scripting or every day command line usage.
This is free and open source software.
Commands provided:
- git-cleanup – deletes all branches that have already been merged into the main branch. Keeps other branches lying around. Removes branches both locally and in the origin remote. Will be most conservative with deletions.
- git-current-branch – returns the name of the current branch, if any.
- git-main-branch – returns the name of the default main branch for this repository.
- git-fixup – amend all local staged changes into the last commit.
- git-fixup-with – interactively lets you pick a commit to fixup with.
- git-active-branches – returns a list of local or remote branches, but contrary to Git’s default commands for this, returns them machine-processable. In the case of remote branches, can be asked to return only the branches in a specific remote.
- git-diff-since – shows the differences made on the current branch, compared to the main branch (or the given branch).
- git-local-branches – returns a list of local or remote branches, but contrary to Git’s default commands for this, returns them machine-processable. In the case of remote branches, can be asked to return only the branches in a specific remote.
- git-local-commits –
- git-merged / git-unmerged / git-merge-status – a trio of subcommands which make it easy to inspect merge status of local branches.
- git-branches-containing – eturns a list of branches which contain the specified ” (defaults to ‘HEAD’).
- git-recent-branches – returns a list of local or remote branches, but contrary to Git’s default commands for this, returns them machine-processable. In the case of remote branches, can be asked to return only the branches in a specific remote.
- git-remote-branches – returns a list of local or remote branches, but contrary to Git’s default commands for this, returns them machine-processable. In the case of remote branches, can be asked to return only the branches in a specific remote.
- git-remote-tracking-branch – print the name of the remote tracking branch of the current or given local branch name, if one exists. Errors otherwise.
- git-repo –
- git-root –
- git-initial-commit – prints the initial commit for the repo.
- git-sha – returns the SHA value for the specified object, or the current branch head, if nothing is provided.
- git-stage-all – mimics the index / staging area to match the working tree exactly. Adds files, removes files, etc.
- git-unstage-all – unstages everything. Leaves the working tree intact.
- git-update-all – updates all local branch heads to the remote’s equivalent.
- git-workon – convenience command for quickly switching to a branch
- git-modified – returns a list of locally modified files. In contrast to git status, it does not include any detailed file status, and never includes non-existing files.
- git-modified-since – like git-modified, but for printing a list of files that have been modified since master (or whatever commit specified). I
- git-separator – adds a commit with a message of only —‘s, so that it visually separates commits in the history
- git-spinoff – creates and checks out a new branch starting at and tracking the current branch. That branch in turn is reset to the last commit it shares with its upstream.
- git-wip – commits all local changes under a commit message of “WIP”.
- Statistics:
- git-committer-info – shows contribution stats for the given committer, like “most productive day”, “most productive hour”, “average commit size”, etc.
- Commands to help novices out:
- git-drop-local-changes – covers aborting rebases, undoing partial merges, resetting the index and removing any unknown local files from the work tree
- git-stash-everything – stashes everything what’s in your index, in your working tree, and even stashes away your untracked files, leaving a totally clean working tree.
- git-push-current – pushed the current branch out to origin, and makes sure to setup tracking of the remote branch.
- git-undo-commit – undo your last commit and you won’t lose any data.
- git-undo-merge – undo the last merge.
- Commands that simplify scripting. These commands typically only return exit codes and have no output:
- git-is-repo – helper function that determines whether the current directory has a Git repo associated to it.
- git-is-headless – tests if HEAD is pointing to a branch head, or is detached.
- git-has-local-changes / git-is-clean / git-is-dirty – helper function that determines whether there are local changes in the working tree, by returning a 0 (local changes) or 1 (no local changes) exit code.
- git-has-local-commits – returns a list of commits that are still in your local repo, but haven’t been pushed to origin
- git-contains / git is-ancestor – tests if X is merged into Y.:
- git-local-branch-exists.
- git-remote-branch-exists.
- git-tag-exists.
- Advanced usage:
- git-skip / git-unskip / git-show-skipped.
- git-commit-to – quickly commit a change to a different branch.
- git-cherry-pick-to – cherry-pick a commit to any branch, staying on the current branch.
- git-delouse – empties the last commit on the current branch and places all changes back into the working tree.
- git-shatter-by-file – splits the last commit into N+1 commits, where N is the number of files in the last commit.
- git-cleave – splits the last commit into 2 or more commits.
Website: github.com/nvie/git-toolbelt
Support:
Developer: Vincent Driessen
License: BSD 3-Clause “New” or “Revised” License
git-toolbelt is written in Bash. Learn Bash with our recommended free books and free tutorials.
Related Software
| Git Workflow Tools | |
|---|---|
| git-extras | Superb collection of tools for Git |
| forgit | Utility for using git interactively |
| wrkflw | Validate and run GitHub Actions workflows locally |
| git-branchless | Branchless workflow for git |
| git-absorb | Super-charging git rebase |
| git-toolbelt | Suite of useful Git commands |
| git-open | Adds a handy git open command to Git. |
| git-town | Automate the creation, synchronization, shipping, and cleanup |
| git-fuzzy | Interactive git with the help of fzf |
| git-recent | Jump between recently used local Git branches |
| git-machete | Robust tool that simplifies your git workflows |
| git-flow-next | Modern implementation of the Git-flow branching model |
| Git Interactive Rebase Tool | Terminal-based sequence editor for interactive rebase |
| git-crecord | Interactively select changes to commit or stage |
| git-xargs | Update across multiple GitHub repositories |
| git-prompt.zsh | Lightweight git prompt for zsh |
| git-imerge | Incremental merge and rebase for Git |
| git revise | Git subcommand and Python library |
| wtp | Enhanced Git worktree management |
| LazyWorktree | Git worktree management for the terminal |
| Hug SCM | The Humane Source Control Management Interface |
| git-smart | Small collection of Git helper commands |
| stax | CLI and TUI for stacked Git branches and PRs |
| git-fixup | Command-line helper for Git users |
| git-autofixup | Git helper that creates fixup commits for topic branches |
| Branchlet | Create and manage Git worktrees |
| git-when-merged | Merge commit finder |
| git-flow | High-level repository operations |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

