May branch off from:
develop
Must merge back into:
develop
Branch naming convention:
anything except master, develop, release-*, or hotfix-*
When starting work on a new feature, branch off from the develop branch.
$ git checkout -b myfeature develop
# Switch to a new branch "myfeature"Finished features may be merged into the develop branch to definitely add them to the upcoming release
$ git checkout develop
# Switched to branch 'develop'. Always checkout the branch you want to merge into
$ git merge --no-ff myfeature
# Use --no-ff flag causes the merge to always create a new commit
$ git branch -d myfeature
# Delete the merged branch
$ git push origin develop
# Push back the origin to the develop branch to remoteMay branch off from:
develop
Must merge back into:
develop and master
Branch naming convention:
release-*
$ git checkout -b release-1.2 develop
# Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2
# Change all the version number in the application
$ git commit -am "Bumped version number to 1.2"$ git checkout master
# Switch to branch master. The branch you want to merge to
$ git merge --no-ff release-1.2
$ git tag -a 1.2To keep the changes made in the release branch, we need to merge those back into develop, though.
$ git checkout develop
$ git merge --no-ff release-1.2
$ git branch -d release-1.2
# Delete the release branchMay branch off from:
master
Must merge back into:
develop and master
Branch naming convention:
hotfix-*
$ git checkout -b hotfix-1.2.1 master
# create a new branch from the master
$ ./bump-version.sh 1.2.1
$ git commit -am "Did the hot Fix 1.2.1"When finished, the bugfix needs to be merged back into master, but also needs to be merged back into develop
$ git checkout master
# Switch to master branch
$ git merge --no-ff hotfix-1.2.1
# Merge it back to the master
$ git tag -a 1.2.1Include the bugfix in develop too
$ git checkout develop
# Switch to develop branch
$ git merge --no-ff hotfix-1.2.1
# Merge the hotfix to develop
$ git branch -d hotfix-1.2.1
# Delete the hotfix branch