Releases: cyrus2281/gitBranchTool
V3.1.1
What's Changed
- Fix bug where tool config was not automatically created by @cyrus2281 in #23
Full Changelog: V3.1.0...V3.1.1
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/MacOS
Run the following command to add the gitBranchTool custom prompt to your shell profile file:
- Change
.bashrc
with.zshrc
if you use ZSH, or the profile file you use if it's different.
echo -e "\nPROMPT_COMMAND='export PS1=\"\$(g _ps)\"'\nprecmd() { eval \"\$PROMPT_COMMAND\"; }" >> ~/.bashrc
Windows PowerShell
Run the following command to add the gitBranchTool custom prompt to your PowerShell profile file:
echo "function prompt { g _ps }" >> $PROFILE
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
get Get configuration options (Run `g get --help` for more information)
getBranchAlias Gets the branch alias
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
set Set configuration options (Run `g set --help` for more information)
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.1.0
What's Changed
- Added
g get
command, (moved getHome to get) by @cyrus2281 in #22
Full Changelog: V3.0.7...V3.1.0
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/MacOS
Run the following command to add the gitBranchTool custom prompt to your shell profile file:
- Change
.bashrc
with.zshrc
if you use ZSH, or the profile file you use if it's different.
echo -e "\nPROMPT_COMMAND='export PS1=\"\$(g _ps)\"'\nprecmd() { eval \"\$PROMPT_COMMAND\"; }" >> ~/.bashrc
Windows PowerShell
Run the following command to add the gitBranchTool custom prompt to your PowerShell profile file:
echo "function prompt { g _ps }" >> $PROFILE
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
get Get configuration options (Run `g get --help` for more information)
getBranchAlias Gets the branch alias
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
set Set configuration options (Run `g set --help` for more information)
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.8
What's Changed
- Add PowerShell Custom Prompt support and fix completion repetition issue by @cyrus2281 in #21
Full Changelog: V3.0.7...V3.0.8
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/MacOS
Run the following command to add the gitBranchTool custom prompt to your shell profile file:
- Change
.bashrc
with.zshrc
if you use ZSH, or the profile file you use if it's different.
echo -e "\nPROMPT_COMMAND='export PS1=\"\$(g _ps)\"'\nprecmd() { eval \"\$PROMPT_COMMAND\"; }" >> ~/.bashrc
Windows PowerShell
Run the following command to add the gitBranchTool custom prompt to your PowerShell profile file:
echo "function prompt { g _ps }" >> $PROFILE
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
set Set configuration options (Run `g set --help` for more information)
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.7
What's Changed
- Add set command with local and global branch prefix & move setDefaultBranch to here by @cyrus2281 in #20
Full Changelog: V3.0.6...V3.0.7
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Run the following command to your terminal profile to add the gitBranchTool custom prompt.
- Change
.bashrc
with.zshrc
if you use ZSH, or the profile file you use if it's different.
echo -e "\nPROMPT_COMMAND='export PS1=\"\$(g _ps)\"'\nprecmd() { eval \"\$PROMPT_COMMAND\"; }" >> ~/.bashrc
- Custom prompt is not supported in Windows PowerShell yet.
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
set Set configuration options (Run `g set --help` for more information)
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.6
What's Changed
- Added promptstring command + updated custom prompt installation by @cyrus2281 in #17
Full Changelog: V3.0.5...V3.0.6
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Run the following command to your terminal profile to add the gitBranchTool custom prompt.
- Change
.bashrc
with.zshrc
if you use ZSH, or the profile file you use if it's different.
echo -e "\nPROMPT_COMMAND='export PS1=\"\$(g _ps)\"'\nprecmd() { eval \"\$PROMPT_COMMAND\"; }" >> ~/.bashrc
- Custom prompt is not supported in Windows PowerShell yet.
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.5
What's Changed
Full Changelog: V3.0.4...V3.0.5
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/Unix Bash
Download and load the gCustomPrompt.sh
file in your .bashrc
or .bash_profile
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.bashrc
Linux/Unix ZSH
Download and load the gCustomPrompt.sh
file in your .zshrc
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.zshrc
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.4
What's Changed
- Fix binary update issue in PowerShell Windows, closes #14 by @cyrus2281 in #15
Full Changelog: V3.0.3...V3.0.4
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Force -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/Unix Bash
Download and load the gCustomPrompt.sh
file in your .bashrc
or .bash_profile
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.bashrc
Linux/Unix ZSH
Download and load the gCustomPrompt.sh
file in your .zshrc
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.zshrc
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.3
What's Changed
- Added removeEntry command + Added safe check around ensuring alias uniqueness by @cyrus2281 in #13
Full Changelog: V3.0.2...V3.0.3
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/Unix Bash
Download and load the gCustomPrompt.sh
file in your .bashrc
or .bash_profile
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.bashrc
Linux/Unix ZSH
Download and load the gCustomPrompt.sh
file in your .zshrc
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.zshrc
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
removeEntry Removes a registered branch entry without deleting the branch
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.2
What's Changed
- Refactored code base to use the new go-logger package + build script by @cyrus2281 in #12
Full Changelog: V3.0.1...V3.0.2
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
(you may need to run PowerShell as an administrator)
Move-Item -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions (by default, the permissions are set to
Everyone: (RX)
)
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/g && sudo g completion bash > /etc/bash_completion.d/g"
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > /etc/bash_completion.d/g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
For default PowerShell profile file, run the following command:
echo "g completion powershell | Out-String | Invoke-Expression" >> $PROFILE
Custom Prompt
Linux/Unix Bash
Download and load the gCustomPrompt.sh
file in your .bashrc
or .bash_profile
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.bashrc
Linux/Unix ZSH
Download and load the gCustomPrompt.sh
file in your .zshrc
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.zshrc
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
V3.0.1
gitBranchTool
Overview
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.
Installation
Linux
-
Download the artifact
g-linux-vX.X.X
from the latest release here -
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/
sudo mv g-linux-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
MacOS
-
Download the artifact
g-macos-vX.X.X
from the latest release here -
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/
sudo mv g-macos-vX.X.X /usr/local/bin/g
- Ensure the binary has the correct permissions
sudo chmod 755 /usr/local/bin/g
Windows (PowerShell)
-
Download the artifact
g-win-vX.X.X
from the latest release here -
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
C:\Windows\System32\
Move-Item -Path .\g-win-vX.X.X.exe -Destination C:\Windows\System32\g.exe
- Ensure the binary has the correct permissions
icacls C:\Windows\System32\g.exe /grant 'Everyone:(RX)'
Auto-Completion
For auto-completion, you can run the following commands based on your shell:
Linux Bash
g completion bash > /etc/bash_completion.d/g
MacOS Bash
echo "\nautoload -U compinit; compinit" >> ~/.bashrc
sudo mkdir -p /etc/bash_completion.d && sudo touch /etc/bash_completion.d/_g && USER=$(whoami); sudo chown $USER /etc/bash_completion.d/_g && sudo chmod 755 /etc/bash_completion.d/_g && sudo g completion bash > "/etc/bash_completion.d/_g"
Linux ZSH
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"
MacOS ZSH
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
Add the following to your PowerShell profile file ($PROFILE
):
g completion powershell | Out-String | Invoke-Expression
Custom Prompt
Linux/Unix Bash
Download and load the gCustomPrompt.sh
file in your .bashrc
or .bash_profile
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.bashrc
Linux/Unix ZSH
Download and load the gCustomPrompt.sh
file in your .zshrc
curl -o ~/.gCustomPrompt.sh https://raw.githubusercontent.com/cyrus2281/gitBranchTool/refs/heads/main/gCustomPrompt.sh
echo "\nsource ~/.gCustomPrompt.sh\n" >> ~/.zshrc
Commands
A bash tool to facilitate managing git branches with long cryptic names with aliases
Usage:
g [command]
Available Commands:
addAlias Adds alias and note to a branch that is not stored yet
completion Generate the autocompletion script for the specified shell
create Creates a branch with name, alias, and note, and checks into it
currentBranch Returns the name of active branch with alias and note
delete Deletes listed branches base on name or alias
getBranchAlias Gets the branch alias
getHome Get the gitBranchTool's home directory path
help Help about any command
list Lists all branches with their name, alias, and notes
rename Updates the alias for the given branch name
resolveAlias Resolves the branch name from an alias
setDefaultBranch Change the default branch, default is main
switch Switches to the branch with the given name or alias
updateBranchNote Adds/updates the notes for a branch base on name/alias
updateCheck Checks if a newer version is available
Flags:
-h, --help help for g
-N, --no-log no logs
-V, --verbose verbose output
-v, --version version for g
Use "g [command] --help" for more information about a command.
Examples
- Create Branch
g c cyrus/jira-60083 banner "Adds banner to the home page"
- Add alias to existing branch
g a cyrus/jira-60083 banner "Adds banner to the home page"
- List all branches
g l
- Switch to branch
g s banner
- Delete branch
g d banner
- Delete multiple branches
g d banner cyrus/jira-50930
- Upgrade the tool to latest version
g uc -y
What's Changed
- Add upgrade command to update the tool to the latest version by @cyrus2281 in #11
Full Changelog: V3.0.0...V3.0.1