A simple terminal branch search for git
bs accepts the following command line arguments:
-
-p: checkout to the selected branch andgit pullafterwards. -
-u:git fetchbefore showing the branches. -
-l: list local branches only. -
[pattern]: if provided, agit checkoutis immediately performed to a branch containing the pattern. For instance,bs mastewill most likely switch tomaster.
The only needed dependency is ncurses. You can read
how to install it in most distros in this tutorial. Once installed just run:
sudo make install
That will compile the thing and copy the binary to /bin/. If you prefer, you may just run make and copy the generated exectable (bs) to your preferred location.
- This could have been a simple python script
First of all, how dare you. Secondly, that's not even a question. A python script wouldn't be as fun.
