Overview
I previously created shortcut Git commands in .bashrc, but it was incomplete, so I made improvements.
While the previous aliases made Git commands somewhat more convenient, the need to type the branch name every time I ran a Git command was a point that needed improvement. I resolved this issue by using select.
Source
I initially thought I could simply use select to loop through the output of git branch, but it also included file names and other unnecessary data, so I had to process it. I found an article doing something similar and used it as a reference.
The commands I created are:
- Checkout a local branch
- Fetch a remote branch to the local environment
- Delete a local branch
I wanted to change the color of the options displayed by select, but I couldn't figure it out, so I left it for later.
Thoughts
The source code for this script is available on GitHub - bmf-san/my-scripts.