Skip to content

Releases: cyrus2281/gitBranchTool

V3.0.0

15 Oct 02:20
Compare
Choose a tag to compare

Complete Rewrite in Go Language!

A bash tool to facilitate managing git branches with long cryptic names with aliases

The gitBranchTool, g, command provides additional functionalities around working with git branches.

If you frequently work with long branch names that include developer names, project names, issue numbers, and etc this tool is for you. With gitBranchTool or g, you'll be able to assign alias names for each branch.

You can monitor, switch, and delete your branches using the aliases instead of the long and confusing branch names (g commands support both branch names and aliases, so you wouldn't have to use git for any of your branch switching needs).

Additionally, You can add notes to each branch to fully remember what they were about so you can keep the aliases shorter. You can list branches with their aliases and notes at anytime.

g also provides auto-completion for branch names and aliases, so you wouldn't even have to type the full alias name.

On top of all these, g provides a custom prompt that displays the name of the current repository, sub-directory, branch name, and its alias. (You can install this by downloading and loading the gCustomPrompt.sh file in your .bashrc or .bash_profile)

Installation

Linux/Unix

  1. Download the latest non-.exe binary from the latest release here

  2. Add the binary to your PATH environment variable (or to a directory that is already in your PATH)

  • A directory that is already in your PATH is /usr/local/bin/ or /usr/bin/

Auto-Completion

For Bash on Linux:

g completion bash > /etc/bash_completion.d/g

For Bash on MacOs:

echo "\nautoload -U compinit; compinit" >> ~/.zshrc
sudo mkdir -p /usr/local/share/zsh/site-functions && sudo touch /usr/local/share/zsh/site-functions/_g && USER=$(whoami); sudo chown $USER /usr/local/share/zsh/site-functions/_g && sudo chmod 755 /usr/local/share/zsh/site-functions/_g && sudo g completion zsh > "/usr/local/share/zsh/site-functions/_g"

For Zsh on Linux:

sudo g completion zsh > "${fpath[1]}/_g"

if getting permission error, try the second line in the MacOs.

For Zsh on MacOs:

echo "\nautoload -U compinit; compinit" >> ~/.zshrc 
sudo mkdir -p ${fpath[1]} && sudo touch ${fpath[1]}/_g && USER=$(whoami); sudo chown $USER ${fpath[1]}/_g && sudo chmod 755 ${fpath[1]}/_g && sudo g completion zsh > "${fpath[1]}/_g"

Windows (PowerShell)

  1. Download the latest .exe binary from the latest release here

  2. Add the binary to your PATH environment variable (or to a directory that is already in your PATH)

Auto-Completion

To add auto-completion to your PowerShell, you can add the following to your PowerShell profile file ($PROFILE):

g completion powershell | Out-String | Invoke-Expression