bash 脚本获取当前 git 所有本地分支
- 新建 local-bracnes.sh 文件
sh 文件内,输入以下内容
#!bin/bash
branches=$(git branch --no-merged master)
for branch in $branches; do
echo "\033[31m \$current branch:\033[0m $branch"
done
- 执行 sh 文件
$ sh local-branches.sh
sh 文件内,输入以下内容
#!bin/bash
branches=$(git branch --no-merged master)
for branch in $branches; do
echo "\033[31m \$current branch:\033[0m $branch"
done
$ sh local-branches.sh