gitversion-controlgit-rewrite-history

How to undo a <history change> push in git?


After a month of working on a personal project, I realized I was using an invalid user.name and user.email so I changed it properly and everything was set right until the last commit done 2 months after. But then I decided that I wanted to change the invalid author name to update my contribution graph for those past commits.

So after reading this answer, I tried:

git rebase -r --root --exec "git commit --amend --no-edit --reset-author"

... to reset the history for the whole project.

But that changed the dates as well. Now I am left with a commit history showing that all the commits of the project were made all at once.

Is there any way to reclaim my old history before resetting it?


Solution

  • git reflog should reveal the commits before your rebase.