I had cherry-picked over 70 commits over the past week from my master branch to another branch with commands:
git cherry-pick -x -n <commit-id>
(made some modifications and then)
git commit
Status says Your branch is ahead of 'origin/another-branch' by 76 commits.
Just a moment ago I thought I could continue my task and pick some commits. The very first commit for today was a wrong one and wanted to undo this cherry-picking, and used the command:
git cherry-pick --abort
And boom, all the 70+ commits seem to be gone. Status says Your branch is ahead of 'origin/another-branch' by 2 commits.
Reflog show these last 2 lines:
c398477f HEAD@{0}: reset: moving to c398477fa2b2e0e78cb628c75df81b2c1ec411cd
8369312d HEAD@{1}: checkout: moving from master to another-branch
Please say there's somehow possible to revert the abort? These commits are/was only in my local branch. And, how the hell did it wipe all the cherry-picked commits, even after I explicityly commited each one of them?
This is the reflog just when I started my cherry-picking a week ago:
d8a71aca HEAD@{52}: checkout: moving from another-branch to dev
8369312d HEAD@{53}: commit: xxx
...
3bb1ff07 HEAD@{127}: commit: xxx
2b9b6542 HEAD@{128}: commit: xxx
c398477f HEAD@{129}: reset: moving to HEAD^
b373db60 HEAD@{130}: commit: xxx
c398477f HEAD@{131}: commit: xxx
8fb419aa HEAD@{132}: commit: xxx
844cbe24 HEAD@{133}: reset: moving to 844cbe2499aadcd0d014999ddb6f847c1d940440
844cbe24 HEAD@{134}: reset: moving to 844cbe24
41e7dbed HEAD@{135}: checkout: moving from 844cbe2499aadcd0d014999ddb6f847c1d940440 to aller-dev
844cbe24 HEAD@{136}: checkout: moving from another-branch to 844cbe24
41e7dbed HEAD@{137}: reset: moving to HEAD^
844cbe24 HEAD@{138}: reset: moving to HEAD^
81bf86ac HEAD@{139}: cherry-pick: xxx
844cbe24 HEAD@{140}: checkout: moving from dev to another-branch
And same with reflog --all:
c398477f refs/heads/another-branch@{0}: reset: moving to c398477fa2b2e0e78cb628c75df81b2c1ec411cd
8369312d refs/heads/another-branch@{1}: commit: xxx
6a4da110 refs/heads/another-branch@{2}: commit: xxx
...
2b9b6542 refs/heads/another-branch@{75}: commit: xxx
c398477f refs/heads/another-branch@{76}: reset: moving to HEAD^
b373db60 refs/heads/another-branch@{77}: commit: xxx
c398477f refs/heads/another-branch@{78}: commit: xxx
8fb419aa refs/heads/another-branch@{79}: commit: xxx
Can I just checkout to 8369312d which is previous to that reset: moving to c398477fa2b2e0e78cb628c75df81b2c1ec411cd?