title: How to fix a branch that should be ahead of master, but is behind?
body: <p>I have a feature branch that should have all its commits as ahead of master, however when I try to merge master into my feature branch like so:</p>
  
  <p><code>(feature)$ git merge master</code></p>
  
  <p>All of my changes in the <strong>feature</strong> branch gets removes. I also tried to use <strong>rebase</strong> but I keep getting the same result.</p>
  
  <pre><code>(feature)$ git rebase master
  First, rewinding head to replay your work on top of it...
  Fast-forwarded feature to master.
  (feature)$ git checkout master
  (master)$ git merge feature
  Already up-to-date.
  </code></pre>
  
  <p>I only did the <code>git merge feature</code> to test if the <strong>rebase</strong> worked, which it didn't as it is <code>Already up-to-date.</code> </p>
  
  <p>It is like somehow at some point my <strong>feature</strong> branch got behind <strong>master</strong>, I am not sure how and when this happened. it might be that the <strong>feature</strong> branch was merged to <strong>master</strong> branch then removed with a new commit, however when I am done with the <strong>feature</strong> branch I would like to add it to <strong>master</strong> at some point in the future when I want to deploy it.</p>
  
  <p>My question is, how can I move all the commits that where made to the <strong>feature</strong> branch ahead of the <strong>master</strong> branch</p>
  
  <p>Or can I recommit all the changes that are currently in <strong>feature</strong> branch after I do a g<code>it merge master</code></p>
  
  <blockquote>
    <p>C1(feature branch) &lt;-- C2(merge master into feature) &lt;-- C3(recommit C1)</p>
  </blockquote>
  
  <p>Notes:</p>
  
  <ul>
  <li>all of what I tried to solve this is on my local machine.</li>
  <li>I work in a team.</li>
  </ul>
  
  <hr>
  
  <h1>Update</h1>
  
  <p>I figured out what exactly happened, somebody created a new branch (<strong>feature-B</strong>) from <strong>feature</strong> branch instead of creating one from <strong>master</strong> branch and then merged <strong>feature-B</strong> into master branch:</p>
  
  <pre><code>(feature)$ git checkout -b feature-B
  ...
  ...
  ...
  (feature-B)$ git checkout master
  (master)$ git merge feature-B
  (master)$ git push
  </code></pre>
  
  <p>and then after figuring out the problem, the same developer reverted the merge of <strong>feature-B</strong> into <strong>master</strong></p>