Created
September 22, 2018 12:28
-
-
Save npasserini/5646b4c93221c07c53a1c6e362b48c42 to your computer and use it in GitHub Desktop.
List dangling commits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PAGER= \ | |
| && git fsck --full --no-reflogs --unreachable --lost-found \ | |
| | grep commit \ | |
| | awk '{print $3}' \ | |
| | xargs -n 1 git log -n 1 --pretty=oneline |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script allows to find a commit that is not referenced by any branch. It is useful in case you accidentally delete a branch that had not been pushed to any remote.