You might benefit from the workflow Scott Chacon describes in Pro Git. In this workflow, you have two branches that always exist, master and develop.
master represents the most stable version of your project and you only ever deploy to production from this branch.
develop contains changes that are in progress and may not necessarily be ready for production.
From the develop branch, you create topic branches to work on individual features and fixes. Once your feature/fix is ready to go, you merge it into develop, at which point you can test how it interacts with other topic branches that your coworkers have merged in. Once develop is in a stable state, merge it into master. It should always be safe to deploy to production from master.
Scott describes these long-running branches as "silos" of code, where code in a less stable branch will eventually "graduate" to one considered more stable after testing and general approval by your team.
Step by step, your workflow under this model might look like this:
For more details on this workflow, check out the Branching Workflows chapter in Pro Git.
After coming in as a novice trying to find a straight-forward strategy to teach to other devs who have never used source control. This is the one that fit http://nvie.com/posts/a-successful-git-branching-model/ I tried using the standard GIT workflow thats in the man pages but it confused me slightly and my audience completely.
Over the past 6 months I have only had to fix conflicts twice. I have added steps to always test after a merge and to 'fetch and merge" or 'pull --rebase" a lot (once in the morning and in the afternoon) while developing features. We also used github.com as the central place to pull the latest code.
(Made my comment above it's own answer, as I should have initially.)
From Scott Chacon of Github:
How We Do It So, what is GitHub Flow?
- Anything in the master branch is deployable
- To work on something new, create a descriptively named branch off of master (ie: new-oauth2-scopes)
- Commit to that branch locally and regularly push your work to the same named branch on the server
- When you need feedback or help, or you think the branch is ready for merging, open a pull request
- After someone else has reviewed and signed off on the feature, you can merge it into master
- Once it is merged and pushed to ‘master’, you can and should deploy immediately
See the entire article for more details: http://scottchacon.com/2011/08/31/github-flow.html
Note that "pull requests" are a Github invention, and it's something that's baked into their website, not Git itself: https://help.github.com/articles/using-pull-requests/
Use the master
branch as your development branch and create release branches for performing bug fixes.
Any new features will go on master
during the development window (either committed directly or as topic branches with pull-requests, up to you -- not shown in graphic). Once all your planned features are implemented, enter feature freeze, and perform testing. When you're happy, tag the release on master
as v1.0
.
Over time your users will find bugs in v1.0
so you'll want to create a branch from that tag (e.g. name it after the release 1.0
) and fix those bugs in the branch. When you've got enough bugs fixed that you think it warrants a new release then tag it as v1.0.1
and merge it back into master
.
Meanwhile a new development window can be happening on the master
branch which will eventually be tagged as v1.1
.
Rinse & repeat.
This follows Semantic Versioning numbering logic.
---------(v1.0)--------------------------------(v1.1)-----------------------------> master
\ \
---(v1.0.1)---(v1.0.2)---> 1.0 ---(v1.1.1)---(v1.1.2)---> 1.1
In a VCS, having just a "master" branch shows quickly its limits because you cannot pursue all the development effort at the same time on one branch.
That means you need to know when to branch.
But in a DVCS (as in "Decentralized" VCS), you also have a publication issue, with branches you keep local to your repositories, and branches you are pushing to or pulling from.
In this context, start by identifying your concurrent development effort, and decide on a publication (push/pull) process. For instance (and this is not the only way):
Other release management processes exist, as this SO question attests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With