To setup and reconfigure gitflow-avh you can follow the steps below.


Install


For more information, please visit gitflow cheatsheet page.


# Mac OS
$ brew install git-flow-avh

# Linux
$ apt-get install git-flow

Setup


Current repository status


Assume that we're in a local git repository. Let's have a look out git settings where gitflow hasn't been initialised yet.


$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:inanzzz/gitflow.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop"]
remote = origin
merge = refs/heads/master

Enable gitflow


Flag -d automatically accepts default options for you.


$ git flow init -d

Which branch should be used for bringing forth production releases?
- develop
- master
Branch name for production releases: [master]

Which branch should be used for integration of the "next release"?
- develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []

Current repository status


Now we have gitflow initialised.


$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:inanzzz/gitflow.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop"]
remote = origin
merge = refs/heads/master
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag =

Reconfiguring


If you did something wrong when enabling git-flow, you can either re-initialise git-flow with git flow init -f command or manually remove git-flow blocks in the config. If you're stuck then just remove git from repository with rm -rf .git command.