title: Git workflow and Gerrit
body: <p>I am trying to implement a 'git-flow' kind of workflow using Gerrit but I can't seem to figure out the last piece of the puzzle. </p>
  
  <p>There are two preconditions to my problem:</p>
  
  <ul>
  <li>Gerrit will only perform merging to one branch</li>
  <li>I do not allow merge commits to be pushed to Gerrit. The merging has to be done by Gerrit after the changes are approved</li>
  </ul>
  
  <p>What I want to solve is the following. Consider this git situation:</p>
  
  <pre><code>Master 0 
          \
           \
  Develop   0-----0-----0-----0
  </code></pre>
  
  <p>There is a master branch with one commit and a develop branch which is forked from master with several additional commits. After a while the develop branch is merged back into master to create the next production release. The developers work with topic branches from develop and with strict rebasing. Their commits are always rebased on top of the latest upstream develop before pushing. This should result in linear history and only fast forward commits.</p>
  
  <p>Now suppose someone creates a hotfix branch from master and merges back to master:</p>
  
  <pre><code>Master 0--------0 HF 
          \
           \
  Develop   0-----0-----0-----0
  </code></pre>
  
  <p>This commit is now only merged to the master branch but the developers need this commit in their develop branch to incorporate the bugfix in their changes. Normally you would merge the master branch to develop the develop branch but considering my preconditions this is not possible as it would create a local merge commit.</p>
  
  <p>My question is: how do I incorporate the new commits from the master branch into the local develop branch so that any new changes by the devs will contain the bugfix? Ideally I would modify my script to first apply the bugfix changes to the local develop branch (merging but without a merge commit) and then rebase the dev's commits and push. This way the bugfix will be automatically added to their new changes and will be seen as such, as part of their new commits, not a seperate commit.</p>
  
  <p>I've been thinking about possible solutions:</p>
  
  <ul>
  <li>Cherry picking the commit to the develop branch. I believe this will always result in a duplicate commit when develop is merged with master the next time. Is there any way around this?</li>
  <li>Rebasing as described here: <a href="http://davitenio.wordpress.com/2008/09/27/git-merge-after-git-cherry-pick-avoiding-duplicate-commits/" rel="nofollow noreferrer">http://davitenio.wordpress.com/2008/09/27/git-merge-after-git-cherry-pick-avoiding-duplicate-commits/</a> . This probably causes problems since the develop branch is published, or won't it?</li>
  </ul>
  
  <p>I hope my question is clear. Please let me know if it needs further clarification. I know I'm being pretty rigid with my workflow, but it would be ideal in combination with Gerrit. If it can't be done then I will probably allow merge commits...</p>