title: How can overwrite the branch from another branch in git
body: <p>I had <code>feature</code> branch and then <code>master</code> branch.</p>
  
  <p>I made copy of <code>feature</code> to <code>feature1</code> and master copy to <code>master1</code></p>
  
  <p>Then i </p>
  
  <pre><code>git checkout master1
  git merge feature1
  # Resolved all conflicts and commited
  </code></pre>
  
  <p>Then i went </p>
  
  <pre><code>git checkout master
  git rebase master1
  </code></pre>
  
  <p>Then i did 1 more commit on master to fix the things</p>
  
  <p>Now i have master branch as i like but i can't push it. 
  so ideally i want to have this new master branch code on my previous <code>feature</code> branch</p>
  
  <p>so that my all previous commits are there as well and i can continue commiting like before</p>
  
  <p><img src="https://i.stack.imgur.com/vq5by.png" alt="enter image description here"></p>
  
  <p>SO in the picture top <code>42bb</code> is my master <code>HEAD</code></p>
  
  <p>and  bottom <code>161a</code> is my feature branch.</p>
  
  <p>I want my feature branch <code>HEAD</code> to be <code>42bb</code> or may be a new commit on feature branch which is equal to <code>42bb</code> commit</p>
  
  <p>I did this but was not sure if that was right</p>
  
  <p><code>git reset --hard master</code> on my feature branch</p>