Reputation: 6866
I was wondering after having some issues with Git what the best way to handle the repo for a website. Currently we have 3 versions of a website; production, beta and development. We've set the Git repo up much the same with 3 branches, master (production), beta (beta), develop (development).
Once we get done with a set of changes/features, we update the development branch then we copy that branch to branch beta. All the while development still continues on the develop branch with more new features etc.
The problem we're having is that inevitably while the code is in beta, bugs are found. Those bugs need to be fixed in both develop and beta branches. Meanwhile more development has been done on the develop branch that doesn't and shouldn't belong in the beta branch so we can't really merge beta and development branches can we? I also don't really want to go through the time and trouble of having to make individual commits to both repos with the change that applies to both.
So what I'm looking for is the best way to manage this type of work flow with Git.
Thanks
Upvotes: 9
Views: 3682
Reputation: 11561
Check out git-flow (aka: A successful Git branching model). Production runs from the master branch, develop from develop and beta from the current release branch (if there is one).
Edit: This answer points to the same approach as the answer by Justin
Upvotes: 7
Reputation: 61
Ok so you have master (production),
You need to do some development based on master so you checkout master and branch with a branch name that describe what you want to add. Ex feature_123.
Checkout feature_123 and work, add, commit, push etc..
Then you find bugs in production, you check out master and branch with a branch name that describe what you want to fix Ex issue_234.
Checkout issue_234 and work, add, commit, push etc..
After the issue_234 is fixed and works, checkout master and merge with issue_234
Then, checkout feature_123 and merge with issue_234.
Both master and feature branch have the bug issue_234 fixed now.
Martin
Upvotes: 0
Reputation: 15369
One of the better approaches I've seen for a concurrent dev-qa-release workflow is "A successful Git branching model". The aha moment for me was the use of --no-ff
to create a "roll-up" commit into the development branch -- this makes features and bugfixes easy to manage.
Upvotes: 5