News for hackers. Stuff that matters.
Re:Git solves all your problems....Almost by lnguyen on Monday May 11, 2009 @03:47PM (#604168)
The git commands, etc. are actually pretty straightforward. What usually causes the issues is thinking about branches. That can be a little hard to wrap your head around especially when you throw in remote repositories.

BTW, here's what they should have done:

  git checkout -b last_good_version [commit]
  git push --force origin last_good_version:master
Preserves the local history but fixes the issue on GitHub.

They probably should also do a few things like:

  git branch -m master master_merge_v2
  git branch -m last_good_version master
to avoid messing things up with the next push
Re:Git solves all your problems....Almost by dasil003 on Monday May 11, 2009 @05:21PM (#604344)
Since I've never had to do this, what happens to the downstream repos that have already pulled the bad merge? Can they do a similar git pull --force to sync up?
Re:Git solves all your problems....Almost by pieter on Monday May 11, 2009 @05:57PM (#604414)
Nope. If they're not careful (or don't know), they'll just merge in the bad commits on the next pull. They'll have to know in advance, and do some manual resetting or use a rebase call.
Re:Git solves all your problems....Almost by lnguyen on Monday May 11, 2009 @10:18PM (#604741)
This is one of problems with changing history in a "master" repository. In this case, it's necessary in order to fix a problem.

Odds are since they're reverting back to an earlier commit on the master branch, anyone who does a pull might not notice the change since they're "ahead" in their history which is okay from the standpoint of the pull (using merge). This will cause a problem for any later push since they'll place the bad commits right back into the GitHub repo. [I'd like to put together a test scenario for this to be 100% but I'm not set up for that at the moment.]

Doing a rebase will lead to the "unmerging" conflicts that they had encountered and caused all their frustration.

Everyone needs to be notified to move (rename) their current master and recreate a master tracking branch:

  git fetch origin
  git branch -m master master_merge_v2
  git checkout -b --track master origin/master
This just solves the problem with the master branch. Any local development branch based directly off the master will need to be rebased. Or they can create a new development branch and cherry-pick.