Git Historical Email Fix, Rebase Mistake

62 Views Asked by At

I accidentally pushed to GitHub with the wrong email.

I 're-wrote' the history using this post: Git, rewrite previous commit usernames and emails

git change-commits GIT_AUTHOR_EMAIL "[email protected]" "[email protected]"
git push origin +master

I now understand I created a new set of commits mirroring the original history. When my colleague pulled, his git client merged the original and new histories (I think he should have deleted / re-cloned):

Parallel histories

I'm pretty sure another rebase & re-clone would fix it, but before I screw it up more, I thought I should ask SO. We are only 2 devs in the same office (so it's be easy to re-clone).

Question: How can I keep the RED branch and permanently discard the equivalent part of the BLUE?

1

There are 1 best solutions below

1
On BEST ANSWER
git checkout master
git reset a281b77 --hard
#if you'd like to keep the blue and discard the red
#git reset ed6bd16 --hard

Locally it's done. If you have pushed the mixed branch with the red and blue to the server, run the command to update it in the server:

git push origin -f master