I'm trying to implement a branching model that is similar to git-flow, but simpler (no release
or hotfix
branches).
The idea is to have the master
branch always up to date with the latest tagged release, a develop
branch that runs parallel to it, and feature
branches to implement longer (more than 1-2 commits) features.
develop
branches from master
and back into it, while the feature
branches do the same in the develop
branch.
This is my branching model:
# 1. While in master, create develop branch, and track it.
# This branch is created once here.
git checkout -b develop
git push --set-upstream origin develop
# 2. Do some minor work and push to develop
git add <file>
git commit -m 'did work'
git push
# 3. To work on a feature, create a branch from develop, and track it
git checkout -b feat/issue9
git push --set-upstream origin feat/issue9
# 4. After work on feature is finished, merge into develop
git checkout develop
git merge --no-ff feat/issue9
# Delete remote and local branches
git push origin --delete feat/issue9
git branch -d feat/issue9
git push
# 5. Once a new release is ready, bump version
git add __version__
git commit -m 'Bumped version number to 0.1'
# 6. Add tag
git tag -a v0.1
git push --tags
# 7. Merge develop into master, and push changes
git checkout master
git merge --no-ff develop
git push
Up to this point, the branches look like this:
This is almost what I want, except that develop
is behind master
by two commits (the bumping of __version__
file, and the merging of develop
into master
)
So I try to bring develop
up to where master
is:
# 8. Merge master into develop
git co develop
git merge master
git push
which results in this:
Once this point is reached, I start again from 2. Do some minor work and push to develop
. A second cycle looks then like this:
Is this a sensible model to be following? Can it give me problems in the future? Any tips to improve it?