0

I messed up in a way I have not seen a solution for resolving due to how I so brilliantly used --amend --reset-author when committing to keep everything on the same commit. Basically, I completed work on a branch, committed and pushed, and then:

  1. checked out master and pulled
  2. checked out my branch
  3. git rebase master, had merge conflict, fixed it
  4. git commit --amend --reset-author BEFORE completing the rebase (oops)
  5. git push -f (fatal, you're not on a branch)
  6. git rebase --continue
  7. git commit --amend --reset-author
  8. git push -f

After force pushing is when I realized that I completely botched the rebase and now when I diff it's including code that isn't mine as changes. Is there any way to fix this? I unfortunately do not have a commit history to work with so I think I might be SOL here.

  • @JohnKugelman Thanks so much for the links. Wow yes I think git reflog might actually do the trick. I didn't see on github ANY history of this thing so I thought all hope was lost. git reflog shows a bunch of stuff – rogerabbott Sep 08 '21 at 02:21
  • 1
    git reflog is the ultimate butt saver. – John Kugelman Sep 08 '21 at 02:24
  • 1
    The reflog stuff is local, in your own Git repository; GitHub do not keep good reflogs. – torek Sep 08 '21 at 02:24
  • @JohnKugelman It worked!! Wow. I was almost in tears haha. This is the coolest git trick I've ever learned. Thanks again for the links. I had looked at a couple and didn't have the confidence to try until you shared. Seriously saved my butt with this. I wish I could mark that as accepted for you. – rogerabbott Sep 08 '21 at 02:34
  • @torek Yeah as I just learned! So good to know. – rogerabbott Sep 08 '21 at 02:36

0 Answers0