0

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 "old@email.com" "new@email.com"
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?

charles-allen
  • 3,891
  • 2
  • 23
  • 35

1 Answers1

2
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
ElpieKay
  • 27,194
  • 6
  • 32
  • 53