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

投稿者: ytyng 3年, 9ヶ月 前

こんな感じでどうでしょう。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
}
現在未評価

コメント

アーカイブ

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011