ブランチ名部分一致で git checkout

2020-07-13 07:07 (6年前)
ブランチ名部分一致で git checkout

こんな感じでどうでしょう。zsh bash

CO() {
if [ ! "$1" ] ; then
echo 'usage: CO branch-name'
git branch
return
fi
branchname=$(git branch --format="%(refname:short)" | grep $1)
if [ ! "$branchname" ]; then
echo "branch name not found. $1"
echo "branch names:"
git brahcn
return
fi
git checkout $branchname
}

アーカイブ