There are 3 types of branches we care about:
- Master - Always working. Only administrators can push to it.
- dev - Integration branch. Most of the testing happens here.
- dev_FEATURENAME - feature branches. In general these should be local only. Exceptions can be made for backup purposes but the parent repos should never contain a reference to a feature branch.
- Code commits happen on feature branches
- Hotfixes can happen anywhere but most likely on dev.
devwill be pushed tomasterfor a product launch.
The following is a standard workflow for checkout->branch->work->rebase->Push workflow. It seems
like a lot of steps but after a few iterations it will make a lot of sense and should become second nature.
- Checkout: Check out the latest
dev - Branch: Create a local feature branch
dev-featurename. Please do not push this branch. It will make rebasing harder later. - Work: Make as many commits as you need to finish the feature.
- Test your feature thoroughly.
- Rebase:
devmay have advanced in the time you took to create your feature so you need to rebase before you can merge with it.- Checkout
devand pull so your local is up to date - Checkout
dev-featurenameand rebase on top of localdev. Fix any conflicts or problems. - Checkout
devagain and merge withdev-featurename. Merge should be smooth without any commits. If you get a commit. Rollback the merge commit and start over.
- Checkout
- Push: Push
devup to master.