wada811 / blog

wada811's blog
https://github.com/wada811/blog/issues
Apache License 2.0
6 stars 0 forks source link

Git のブランチが存在するかチェックする #35

Open wada811 opened 5 years ago

wada811 commented 5 years ago

Why

Git のブランチが存在するかチェックしたい。

What

Git のブランチ名のリストを grep する。

How

BRANCH="develop"
test -n "$(git branch -a --format="%(refname:short)" | grep -e ^$BRANCH$)"

Ref