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.
Popular series | |
---|---|
The largest compilation of the best free and open source software in the universe. Each article is supplied with a legendary ratings chart helping you to make informed decisions. | |
Hundreds of in-depth reviews offering our unbiased and expert opinion on software. We offer helpful and impartial information. | |
The Big List of Active Linux Distros is a large compilation of actively developed Linux distributions. | |
Replace proprietary software with open source alternatives: Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle, Atlassian, Corel, Cisco, Intuit, and SAS. | |
Awesome Free Linux Games Tools showcases a series of tools that making gaming on Linux a more pleasurable experience. This is a new series. | |
Machine Learning explores practical applications of machine learning and deep learning from a Linux perspective. We've written reviews of more than 40 self-hosted apps. All are free and open source. | |
New to Linux? Read our Linux for Starters series. We start right at the basics and teach you everything you need to know to get started with Linux. | |
Alternatives to popular CLI tools showcases essential tools that are modern replacements for core Linux utilities. | |
Essential Linux system tools focuses on small, indispensable utilities, useful for system administrators as well as regular users. | |
Linux utilities to maximise your productivity. Small, indispensable tools, useful for anyone running a Linux machine. | |
Surveys popular streaming services from a Linux perspective: Amazon Music Unlimited, Myuzi, Spotify, Deezer, Tidal. | |
Saving Money with Linux looks at how you can reduce your energy bills running Linux. | |
Home computers became commonplace in the 1980s. Emulate home computers including the Commodore 64, Amiga, Atari ST, ZX81, Amstrad CPC, and ZX Spectrum. | |
Now and Then examines how promising open source software fared over the years. It can be a bumpy ride. | |
Linux at Home looks at a range of home activities where Linux can play its part, making the most of our time at home, keeping active and engaged. | |
Linux Candy reveals the lighter side of Linux. Have some fun and escape from the daily drudgery. | |
Getting Started with Docker helps you master Docker, a set of platform as a service products that delivers software in packages called containers. | |
Best Free Android Apps. We showcase free Android apps that are definitely worth downloading. There's a strict eligibility criteria for inclusion in this series. | |
These best free books accelerate your learning of every programming language. Learn a new language today! | |
These free tutorials offer the perfect tonic to our free programming books series. | |
Linux Around The World showcases usergroups that are relevant to Linux enthusiasts. Great ways to meet up with fellow enthusiasts. | |
Stars and Stripes is an occasional series looking at the impact of Linux in the USA. |