Replies: 1 comment
-
|
@gemadhavi To recover your work, you need to find the last commit you made before the rebase started. Since your code isn't pushed, git reflog is your only map.
Verify the code: Restore the branch:
Why use --stat? It shows line counts (+500/-0) so you can identify the right commit without reading 500 lines of diff. Search by code: If you know a unique function name you wrote, find its commit with: If this solution helped you, please mark it as an approved answer to help others |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I messed up badly and need ugrent help recovering my work.
Background:
Working on a feature branch for the past 2 days. Made good progress - around 500 lines of code across multiple commits. Didn't push yet because I wanted to clean up the commit history first.
What Happened:
feature/user-authbranch with 3-4 commitsgit checkout main && git pullgit rebase maingit rebase --continuegit rebase --abortbut not sure if it workedgit reset --hard HEAD~3git reflog, tried resetting to what I thought was the right commitCurrent Situation:
$ git status
HEAD detached at 7f3a891
nothing to commit, working tree clean
My git reflog has like 60+ lines and I honestly can't figure out which commit has my actual work. I've tried git reset --hard to a few different commits but keep ending up in the wrong place.
What I've Tried:
git reflog - too many entries, can't identify the right one
git show on several commits - diffs are huge, hard to verify
git log --all --oneline - doesn't show my lost commits
Googling "recover lost commits git" - everyone says use reflog but I AM and it's not helping
Questions:
How do I systematically find the right commit in reflog?
Is there a way to see what each reflog entry actually contains without manually checking diffs?
Should I be looking for specific reflog messages like "rebase (start)" or "commit:"?
Is my work actually recoverable or could it be garbage collected already?
I've been stuck on this for over an hour. The reflog output is just overwhelming and I'm worried about making it worse. Any advice would be really appreciated.
Beta Was this translation helpful? Give feedback.
All reactions