I have two main branches: master
and develop
.
My usual workflow on a new feature is:
- Create a new branch from develop:
git checkout -b <myfeature> develop
- Code and test the feature
- Commit the changes:
git commit -a -m "<message>"
- Change back to develop:
git checkout develop
- Merge the feature back into develop:
git merge --no-ff <myfeature>
- Delete the branch:
git branch -d <myfeature>
- Push develop to remote:
git push origin develop
Now I need to work on a new feature that requires the current feature. My new workflow would be:
- Create a new branch from develop:
git checkout -b <myfeature> develop
- Code and test the feature
- Commit the changes:
git commit -a -m "<message>"
- QA is currently validating
- Create a new branch from myfeature:
git checkout -b <newfeature> <myfeature>
- Start coding newfeature
- QA is done validating, commit current code:
git commit -a -m "<message>"
- Change back to develop:
git checkout develop
- Merge the feature back into develop:
git merge --no-ff <myfeature>
- Delete the branch:
git branch -d <myfeature>
- Push develop to remote:
git push origin develop
- Change back to newfeature:
git checkout newfeature
- Finish coding newfeature
- Commit the changes:
git commit -a -m "<message>"
- Change back to develop:
git checkout develop
- Merge the feature back into develop:
git merge --no-ff <newfeature>
- Delete the branch:
git branch -d <newfeature>
- Push develop to remote:
git push origin develop
Is this a proper workflow? Is there any repercussions to deleting the branch in step 10 (i.e. does it orphan newfeature?)?
The original guidelines were from Vincent Driessen's A successful Git branching model. I also read Create a branch in Git from another branch, but it doesn't really get into deleting the branch that spawned the new branch.