如何在 bash 脚本中使用 git 当前分支

how-to-use-git-current-branch-in-bash-scripts.sh
# 分支是,例如,"main"
export branch=$(git branch --show-current)

Check out similar posts by category: Git, Linux, Version Management