branch間の移動を数字で行う方法
メモ書きです
git checkout branch-name
で、いつもbranch移動をしていた。
branch移動は、頻繁に行うため簡略化すると生産性が向上するので、調査を行った。以下のAliasを追加すればよい。
$ cat ~/.gitconfig [alias] b = "! git branch | cat -n" sbn = "!f() { branch_name=$(git branch --format='%(refname:short)' | head -n $1 | tail -n 1); git checkout $branch_name; }; f" # switch branch by number