title: Git rebase approach to avoid duplicate commits
body: <p>There is strange issue I am facing when I am trying to do the rebase into my development branch from master. There is some work in progress in the master as well as in dev branches.</p>
  
  <p>In order to get the changes from master I do below</p>
  
  <pre><code>git checkout dev
  git rebase master
  </code></pre>
  
  <p>This works fine. But - </p>
  
  <ol>
  <li>The <code>dev</code> branch commits are duplicating when I do
  <code>
  git checkout dev
  git add .
  git commit -m 'some change'
  git push
  git rebase master
  </code>
  the commit<code>some change</code> is repeating in git project history for dev branch. It also creates the loop .</li>
  <li>If I do <code>git rebase master</code> before pushing the dev branch changes then it works well and I can see linear history in project.</li>
  </ol>
  
  <p>I am not sure why it is like that. This seems to me the strange behaviour. Please help if anyone can explain this.</p>
  
  <p><strong>Project History</strong> 
  commit <code>b48659d</code> is duplicating(original commit I did <code>37c07a4</code>) when first did push and then rebase in dev branch.</p>
  
  <pre><code>*   fbadb86 (HEAD -&gt; dev) Merge branch 'dev' of *******
  |\  
  | * b48659d (origin/dev) sample added in dev branch --&gt; did rebase after push and got this commit again
  * | 37c07a4 sample added in dev branch --&gt; commit + push
  * | 46c1f40 (origin/master, origin/HEAD, master) master file added in master branch --&gt; commit + push
  |/  
  * 5baae80 first commit
  </code></pre>
  
  <p>And this happens for all commits after doing the push. That is causing lots of issue in rebasing as the commits are repeating and also creating lot off conflicts even with my own code changes from previous commits.</p>