Tuesday, March 29, 2011

git recover lost commits

Sometimes, if there's no reference to a commit, it looks as though git has thrown it away. (Indeed if you do git gc, it will throw it away).

In this situation,

$ gitk --show-dangling

will give you enough information to save your ass.

You can also use:

$ gitk --all $(git log -g --pretty=format:%h)

to much the same effect.

No comments:

Post a Comment