title: Git: multiple branches deployment workflow
body: <p>I'm trying to understand how to best improve my workflow when working with multiple branches each of which will deploy to a specific environment.</p>
  
  <p>Let's start by saying I'm using BitBucket to host my git repository and I have three branches on it: <code>origin/master</code>, <code>origin/staging</code> and <code>origin/production</code>. </p>
  
  <p>Whenever I complete a new task I commit the task to my local branch <code>master</code> and then I push it to <code>origin/master</code>. After that if I want to deploy that commit to staging I simply open the branches and run a "sync" (using the BitBucket feature) so that the branch <code>origin/staging</code> matches with <code>origin/master</code>.</p>
  
  <p>However, when I look at the repository on SourceTree it feels like I made a mess and that this is probably not the correct way of doing it.</p>
  
  <p>This is how the repository looks like on SourceTree:</p>
  
  <p><a href="https://i.stack.imgur.com/JU44O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JU44O.png" alt="enter image description here"></a></p>
  
  <p>And this is how it looks on BitBucket:</p>
  
  <p><a href="https://i.stack.imgur.com/RBD0Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RBD0Q.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/RBD0Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Btt2.png" alt="enter image description here"></a></p>
  
  <p>First of all: Why does it say that <code>origin/production</code> and <code>origin/staging</code> are respectively 4 and 6 commits ahead of <code>origin/master</code>?</p>
  
  <p>Secondly, if what I'm doing is wrong/can be improved, what would you suggest me to do?</p>