Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>git push -f origin myBranch </code></pre> <p>should work (provided you are aware this can be dangerous if MyBranch was already fetched by others in their own repo)</p> <p>Note: if your remote repo ('origin') has its <a href="http://linux.die.net/man/1/git-config" rel="noreferrer">config</a> set with</p> <pre><code>receive.denyNonFastForwards true </code></pre> <p>it will deny any non fast-forward push (even when forced).<br> See "<a href="https://stackoverflow.com/questions/1754491/is-there-a-way-to-configure-git-repository-to-reject-git-push-force">Is there a way to configure git repository to reject 'git push --force'?</a>".</p> <hr> <p>The <a href="https://stackoverflow.com/users/654019/user654019">OP user654019</a> reports</p> <blockquote> <p>I managed to solve the problem this time by setting <code>denyNonFastForwards</code> to <code>false</code> and using <code>-f</code> to force the push</p> </blockquote> <p>If the OP didn't have access to the repo, he/she would have to:</p> <ul> <li>reset the local HEAD to its original position (see "<a href="https://stackoverflow.com/questions/5788037/recover-from-git-reset-hard">Recover from <code>git reset --hard?</code></a>"):<br> <code>git reset HEAD@{1}</code></li> <li>make a <em>new</em> commit which cancel your merge, as described in the <a href="http://progit.org/2010/03/02/undoing-merges.html" rel="noreferrer">ProGit book</a>, with <a href="http://linux.die.net/man/1/git-revert" rel="noreferrer"><code>git revert</code></a>:<br> <code>git revert -m 1 HEAD~</code> (in your case)</li> </ul> <p>By example:</p> <pre><code>$ git revert -m 1 [sha_of_C8] Finished one revert. [master 88edd6d] Revert "Merge branch 'jk/post-checkout'" 1 files changed, 0 insertions(+), 2 deletions(-) </code></pre> <p><img src="https://i.stack.imgur.com/gvoUj.png" alt="revert a merge"></p> <p>A complete discussion on how to revert a merge can <a href="http://git.kernel.org/?p=git/git.git;a=blob;f=Documentation/howto/revert-a-faulty-merge.txt;hb=master" rel="noreferrer">be found here</a>.</p> <p>The idea remains to generate only <em>new</em> commits, including one reverting the changes introduced by the merge commit.<br> You then can push that new commit, as a fast-forward change.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload