Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove incorrect merges from repository
    primarykey
    data
    text
    <p>I'm not happy with the title but I think I overcomplicated my explanation and it is as simple as above in the end.</p> <p>We are using a branching model with a central origin repo, a "develop" branch, with feature branches off this branch.</p> <p>I had developed a local set of changes off the develop branch, something like:</p> <pre><code>develop (A)- (D1) - (D2) \ - (F1) - (F2) - (F3) - (F4) </code></pre> <p>At this point I slipped up in my git gui and, instead of pushing my feature branch as a remote branch to origin, I somehow pushed it back into origin/develop. So, we now had:</p> <pre><code>develop (A)- (D1) - (D2) - - (M1) \ - (F1) - (F2) - (F3) - (F4) / </code></pre> <p>Which we didn't want just yet. Since there was only my self and one other developer in on this particular day, I logged into the origin host and manipulated the develop head back to the D2 commit and my feature branch back to F4. I asked my colleague not to pull until I'd done this, and thought therefore that all was well.</p> <p>(in actual fact I cloned the origin repo, made the head changes locally, and then force-pushed them back upstream. I don't actually remember the exact commands but the outcome was the repo as desired, as far as I could see).</p> <p>What I had forgotten is that our continuous integration system was doing regular pulls and managed to get a copy of the merged heads. A week later I noticed some commits by cruisecontrol on the origin host and got a bad feeling. Sure enough it was merging the origin develop head into its local "feature branch merged" repo.</p> <p>So we are now in a situation somewhat like this:</p> <p>Cruisecontrol repo:</p> <pre><code> (from origin/develop) (C1) - (C2) - (C3) develop (A)- (D1) - (D2) - - (M1) \ (M2) \ (M3) \ - (F1) - (F2) - (F3) - (F4) / </code></pre> <p>Origin repo:</p> <pre><code>develop (A)- (D1) - (D2) - (C1) - (C2) - (C3) \ - (F1) - (F2) - (F3) - (F4) </code></pre> <p>Where C1 and C2 are commits made into the origin repo by us developers who have the "corrected" repo (ie after my head manipulations to undo my initial mistake), and M2 and M3 are the merge commits that the cruisecontrol repo now had to make.</p> <p>Now I did something <em>really</em> stupid. I "git push"'ed in the cruisecontrol source repo. So our "origin" repo now has the M1 merge and the intervening M2 and M3 merges.</p> <p>I've once again got my colleagues to not pull for a while. However, my git-foo is not strong enough to detangle the Mx and Cx commits from each other in the origin repo and restore things back to how they should be.</p> <p>I <em>think</em> I need to do something clever with HEAD^(x) and HEAD~(y), but this is a difficult situation to explain succinctly and thus rather hard to google for.</p> <p>All advice welcomed; I have a nightly backup of the repo running and can probably just restore from that and have everyone re-push their commits from today, but I'd like to know if this type of branch detangling is possible at all.</p> <p>I think I should be able to end up with the origin repo as in the above origin diagram, and the cruisecontrol repo deleted and re-cloned, and the M series of commits ready to be garbage collected in the origin repo.</p> <p>Thanks!</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.
 

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