Before doing anything else, make a copy of your local repo.
git fsck --lost-found ( git fsck --dangling), ( SHA), git reflog, , .
:, , , "reflog" ( , reflog). , , git log --walk-reflogs --oneline --decorate, /.
/ ( / ), SHA , , ( ).
git log --graph --all --online --decorate ( ), , , , .
: git, , , " ", git, , .
:.
D:\software\sandpit\branchclonetest > git log --graph --oneline --all --decorate
* 77d69c7 (HEAD -> fromNewBranch, origin/master, origin/fromNewBranch, origin/HEAD) new file
* 88181c4 (origin/new_branch) new file
* 175d1e1 (origin/test_branch_1) file for merge back to master
* 5d5b028 file added in branch
* 777984b yet another file
* e0652e8 (origin/logoff) new test files added
- / .
D:\software\sandpit\branchclonetest > git fsck --lost-found
Checking object directories: 100% (256/256), done.
dangling commit 92cacfdb6265075b8fae5fd63b21219cf91ea0ec <-- WANT THIS ONE
dangling commit 1ad608bd48fc8bdedd186d05cc486974d6890265
dangling commit 59622d01426d876aec3a7e9265d52648a66e13e5
- Checkout lost commit 92cacf...
D:\software\sandpit\branchclonetest > git checkout 92cacfdb6265075b8fae5fd63b21219cf91ea0ec
Note: checking out '92cacfdb6265075b8fae5fd63b21219cf91ea0ec'... etc...
- , , :
D:\software\sandpit\branchclonetest > git log --graph --oneline --all --decorate
* 77d69c7 (origin/master, origin/fromNewBranch, origin/HEAD, fromNewBranch) new file
* 88181c4 (origin/new_branch) new file
* 175d1e1 (origin/test_branch_1) file for merge back to master
* 5d5b028 file added in branch
* 777984b yet another file
| * 92cacfd (HEAD) test <--- COMMIT FOUND HERE
|/
* e0652e8 (origin/logoff) new test files added
. - git gc () , / ...
Update:
, - , , . "-walk-reflogs" "-g" git.
, , / - ( ).
, , git log --walk-reflogs , : git log --walk-reflogs --oneline --decorate ( , /, ).