0

We have 2 branches in a repository aaa/project:

  • master is for production
  • dev is for developpement

Every developper forks aaa/project (developer-name/project) and create branches for each feature. When a feature is ok, developer push to his branch, then do a pull request to aaa/project on dev branch.

Sometimes, dev branch (from aaa/project) is merged into master branch (with 3 or 4 well tested feature).

My problem is:

If something is pushed to master branch (critical bug that needs to be in prod ASAP, assuming we have CI), dev branch is not up to date with master branch (on aaa/project).

How can we have dev branch just like master branch just after we merged dev into master ?

We are using git and bitbucket for hosting (I would prefer a solution directly in bitbucket, because we only clone from our repositories (developer-name/project)).

Hope it's clear enough, thanks a lot.

rap-2-h
  • 30,204
  • 37
  • 167
  • 263
  • Is there a reason that you can't just merge master into dev? Dev *should* always get any changes that master has anyway. Since it sounds like you're merging/pushing to master by some other means, it should be a requirement to update dev with those changes also. For critical bugs you could branch from master, then submit PR back to master *and* dev branches. – trnelson Oct 22 '14 at 10:30
  • @trnelson Thanks. _"Is there a reason that you can't just merge master into dev?"_ Not really :). I thought it's strange to merge `dev` into `master`, then `master` to `dev`. It's like a circle, but if you says it's acceptable, maybe we will do that. – rap-2-h Oct 22 '14 at 12:06
  • Maybe it's related with http://stackoverflow.com/questions/16955980/git-merge-master-into-feature-branch (but not sure) – rap-2-h Oct 22 '14 at 12:15

1 Answers1

2

As trnelson is saying. It is completely normal to merge also from master branch to dev branch. You could take a look on this excellent presentation about git branching model from Lemi Orhan Ergin! In our company we have implemented our git workflow according to this presentation.

I'm attaching a screenshot of one slide which, I think, is your case. Hot fix in production

This is the link for the whole presentation Git Branching Model

Hoppus Hoppard
  • 481
  • 1
  • 4
  • 15