I have a repository with a number of branches
b1-long-name
, b2-long-name
, b3-too-long-name
I want to be able to switch between branches fast. Also I want to run additional git command before I switch the branch.
I trying to approach that with a bash script, here is my custom script gitSwitch.sh
#!/bin/sh
set -e
git reset #<-- additional command
git checkout -f b2-long-name
But the problem here I have to create a script per branch that I do not really want, I wonder how would you pass a param to the script so it will use a proper branch name?
gitSwitch b1
-> would checkout b1-long-name
gitSwitch b2
-> would checkout b2-long-name
and so on
Any ideas how to approach it best?