3 ms·
`git fsck --no-reflog` will show you orphan commits. Search for "dangling commit" in the output. It will take a while to run on larger repositories. If you hav
by rjmunro 3y ago
`git fsck --no-reflog` will show you orphan commits. Search for "dangling commit" in the output. It will take a while to run on larger repositories.
If you have gitk installed, this command will show a complete git tree, including dangling commits / branches:
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
It may take a while to run.
A faster command is gitk --reflog which will use the reflog to find recent dangling commits. It's a great way to get a branch back if you have rebased or deleted it.