Confused about github rebasing
Daniel Murphy
yebblies at nospamgmail.com
Thu Mar 15 19:43:52 PDT 2012
"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message
news:mailman.719.1331847338.4860.digitalmars-d-learn at puremagic.com...
> Actually, I discovered that my origin/master branch was also broken
> (probably due to running the wrong git command in it in the past),
> because it had a bunch of commits from upstream that for some reason had
> different hashes (maybe the result of attempting to merge from a messed
> up branch?). This is probably why my topic branch was messed up in the
> first place, I think.
>
> So I did git reset --hard to clean up the history back to the point
> where it first starting diverging, then pulled from upstream/master
> (which I confirmed were fast-forward). Then I used `git push -f master`
> to clean up the history on github. So that takes care of master.
>
I used to have this problem all the time - now I have a script which checks
out master and pulls with -ff-only (in all three repositories) giving me a
nice big error if I accidentally committed to master. Although I think I
just lost it when my hard drive died yesterday...
Get to know rebase -i as well, it can be very useful for untangling history.
More information about the Digitalmars-d-learn
mailing list