Let's say that I have a graph like this:
A---B---C---D (master)
\
\-E---F (HEAD)
If I do git log --all --oneline
, I will get all six of my commits.
But if the graph is
A---B---C---D (master, HEAD)
\
\-E---F
I will not see E and F. Can I get git to tell me all the commits, including those on branches which are not named?
Thanks
When I tackle this issue I use the following command:
This lets me visualise recent commits which have become headless.
I have this wrapped up in a script helper called
~/bin/git-reflog-gitk
.Like @Kieran 's Answer, but for the console:
git log --oneline --all --graph --decorate $(git reflog | awk '{print $1}')
Try:
which lists all git commits by pretending that all objects mentioned by reflogs (
git reflog
) are listed on the command line as<commit>
.If you use Git Extensions GUI it can show you a graphical visualization of dangling commits if you check "View -> Show reflog references". This will show dangling commits in the tree, just like all other referenced ones. This way it is way easier to find what you are looking for.
See this image for demonstration. Commits C2, C3, C4, and C5 on the image are dangling but still visible.