以编程方式确定 git-flow 是否已初始化
Programmatically determine if git-flow is initialized
有什么办法吗?如果 repo 仅在 .git/config
中具有 git-flow 指令,如
,是否认为该 repo 已初始化
....
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag = v
?
Answered here。基本上:
- 检查 gitflow.branch.master 的配置以及分支是否存在于 repo
- 检查 gitflow.branch.develop 的配置以及该分支是否存在于 repo
- master分支不能和develop分支相同
- 确保配置了所有前缀。
我要检查的是 运行 以下命令:
git flow config >/dev/null 2>&1
。如果它已初始化,则它以 0
退出,否则以 1
.
退出
我经常这样做:
if $(git flow config >/dev/null 2>&1)
then
echo initialized
else
echo not initialized
git flow init -d
fi
我有时会做空:
git flow config >/dev/null 2>&1 || git flow init -d
有什么办法吗?如果 repo 仅在 .git/config
中具有 git-flow 指令,如
....
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag = v
?
Answered here。基本上:
- 检查 gitflow.branch.master 的配置以及分支是否存在于 repo
- 检查 gitflow.branch.develop 的配置以及该分支是否存在于 repo
- master分支不能和develop分支相同
- 确保配置了所有前缀。
我要检查的是 运行 以下命令:
git flow config >/dev/null 2>&1
。如果它已初始化,则它以 0
退出,否则以 1
.
我经常这样做:
if $(git flow config >/dev/null 2>&1)
then
echo initialized
else
echo not initialized
git flow init -d
fi
我有时会做空:
git flow config >/dev/null 2>&1 || git flow init -d