Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is that you used <code>git revert</code> instead of <code>git reset --HARD</code>. <code>git revert</code> creates a new commit that redoes the changes of the previous commit. <code>git reset</code> does the same, but not by creating a new commit, but by throwing away the faulty commit. Because of that the faulty commit still sits in your history.</p> <p>Merging 2 to HEAD doesnt work, because you are trying to merge with your own history. It is like trying to merge 4 into 2.</p> <p>What you need to do is, throw away 0 and make a new one.</p> <p>First, reset master back to 1 using:</p> <pre><code>git reset --HARD 1 </code></pre> <p>Then, reach a clean, merge-ready state there (you can do commits if you need to).</p> <p>After that, make sure branch-1 points to 2:</p> <pre><code>git checkout branch-1 git reset --HARD 2 </code></pre> <p>Reach a clean, merge-ready state there too. Then, merge them both:</p> <pre><code>git checkout master git merge branch-1 </code></pre> <p>Check the result of the merge. If it didnt work as you want, start over by reseting master and branch-1 again. If you can't get merge working, you might also try a rebase. This will flatten your history to a look like that:</p> <pre><code>2' -- .. -- 4' -- 1 -- .. -- 3 -- 5 </code></pre> <p>After you merged or rebased the two branches together, you may rebase any changes that were introduced after the reverted commit (Replace <code>2'</code> with the most current commit of the new merge/rebase you created, dont use HEAD as it will change once the command runs):</p> <pre><code>git rebase 2' -2 </code></pre> <p>After that, your history should look like that:</p> <pre><code>-2' -- .. -- 2' -- .. -- 4' -- 1 -- .. -- 3 -- 5 </code></pre> <p>Or, if you merged instead of rebase:</p> <pre><code>-2' -- .. -- 0' -- 1 -- ... -- 3 -- 5 \ -- 2 -- ... -- 4 --/ </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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