comment 0

Show all commits with gitk (or, never lose any commit)

Here is one my of life-saving git command, that allowed me to retrieve lost commit easily in the past few years:

Save this alias carefully in your bashrc. It will launch gitk displaying the dangling commits, ie, the commits that have no more meaning in life, no tag, no branch, no HEAD pointing to it.

This will allow you to:

  • browse in the history of your patch, with previous states before all amending and rebases
  • find lost commits on untagged branch, of removed/abandoned branch
  • restore easily after a failed rebase.

Please beware the old dandling commits are typically removed by git after 15 days ( git gc ).