Can I get git fsck to show commit names? -
i have deleted commit, among many deleted commits, i'm trying restore. found out fsck --lost-found command. great!
the problem have on hundred dangling commit statements little information.
dangling commit 654857f5e8418c4031e1d8411579906c528da562 dangling commit 74499bd482d688c1416d5091b391d82a438855a9 dangling commit 124ed7cd4465434865577c82757732df62febb59 dangling commit 92573bf4595be6f80f22eba94548dbc88d8796fc dangling commit 125b0ffa3f0db71f23fda65d6adb2f9941748cc0 dangling commit ba5b1f8d6d920900abc88bd725d44ba86c8c772f dangling blob e760d751ae4e3dab9beed0996e683c0f291eb4cc
if throw out commit name sha big help. is, have run git show on each one, one-by-one, find right commit. there easier way?
this not answer solving git fsck, might work in situation.
git reflog
outputs list of past heads in repository. example, if switch branch master branch devel, produces reflog entry head of master branch.
so if commit part of branch @ time, chances great can recover using combination of git reflog
, git log
, bit of manual work.
there few cases:
just fire
git reflog
, scroll through it. if shows commit message looking for, that’s great! copy commit id , use whatever want (e.g.git cherry-pick
, or save branch usinggit branch save-my-commit commitid
).the commit not directly in
git reflog
, see commit made after commit want find (and before deleting it). in case, use commit id of commit made afterwards found ingit reflog
, pass argumentgit log
:git log commitid
. scroll through output , see if can find commit. use commit id in case 1.the commit not directly in
git reflog
, not find commit of know made after commit deleted , before deleting it.this tedious case, in case might easier go through other processes here. not sure though listed dangling commits, worth shot if cannot find commit using
git fsck
.go on entries in
git reflog
, use commit ids argumentgit log
described in case 2. try find commit after.
good luck!
Comments
Post a Comment