Git-Tool is capable of more than just file organization, its great cross-platform autocomplete support makes it ideally suited to solving some other common problems we run into during our day-to-day development.
Git has recently shipped with a wonderful new
switch command which simplifies changing branches (when compared to the sometimes confusing
git branch and
git checkout -B combination). We're big fans of Git-Tool's autocomplete though, so we've wrapped all the lovely git goodness up in Git-Tool and paired it with our search engine to make your life just that much easier.
This command has replaced the old
gt branch command since
v2.2.0 as it serves the same purpose and uses the same command line arguments.
--no-createprevents the branch from being created if it doesn't exist already.
# Checks out the feature/demo branch, creating it if it doesn't exist yet gt sw feature/demo # Checks out the feature/demo branch if it exists gt b -N feature/demo
Setting up your
.gitignore files and keeping them updated can be a bit of a faff. It takes time, it doesn't add much core value and we often forget little things when then require us to clean out repo history.
gitignore.io is one approach to solving this. It offers a wide range of pre-built
.gitignore files for different languages and frameworks. Git-Tool gives you a command which combines this with some useful metadata to allow quick updates and additions.
--pathallows you to specify the path to the
.gitignorefile you wish to update. By default, this will be
# View the list of all supported .gitignore languages/frameworks gt ignore # Add a .gitignore file (or update your existing one) for Node.js and C# gt ignore node csharp
Git-Tool will automatically fetch the latest ignore files from gitignore.io for the languages you have added whenever you run
gt ignore $LANG and retain changes you made outside the metadata blocks.
If you're the kind of person who uses branches and Pull Requests to make changes to your repositories, you'll often end up with a small horde of branches in your local repository which are remnants of previously merged PRs. Cleaning these out can be a bit of a chore, so Git-Tool provides a
prune command which will identify any merged branches (using
git branch --merged) and remove them for you automatically.
--yeswill skip the confirmation prompt and remove any branches that are found.
# Remove any merged branches from your local repository gt prune