Programmatically determine if git-flow is initialized
Asked Answered
O

2

9

Is there any way to do this? Is the repo considered initialized if it simply has the git-flow directives in .git/config like

....
[gitflow "branch"]
    master = master
    develop = develop
[gitflow "prefix"]
    feature = feature/
    release = release/
    hotfix = hotfix/
    support = support/
    versiontag = v

?

Overbuild answered 11/2, 2015 at 20:50 Comment(0)
O
5

Answered here. Basically:

  1. Check config for gitflow.branch.master and if the branch does exist in the repo
  2. Check config for gitflow.branch.develop and if the branch does exist in the repo
  3. Master branch can not be the same as develop branch.
  4. Make sure all the prefixes are configured.
Overbuild answered 20/2, 2015 at 0:37 Comment(0)
D
3

What I do to check is I run following command: git flow config >/dev/null 2>&1. If it is initialized, then it exits with 0 otherwise with 1.

I usually do something like this:

if $(git flow config >/dev/null 2>&1)
then
    echo initialized
else
    echo not initialized
    git flow init -d
fi

I some time short it like: git flow config >/dev/null 2>&1 || git flow init -d

Daudet answered 26/11, 2019 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.