Git Reflog

#git #buildbot

The post-update hook for a git repository that works with buildbot uses $(git rev-parse 'HEAD@{1}') to get the previous revision that is to be passed to the buildbot python script.

If the reflog is disabled in your repository, the default for skeleton repositories, then rev-parse won’t have anything to search for and you’ll get an error similar to this one:

fatal: ambiguous argument 'HEAD@{1}': unknown revision or path not in the working tree.

Once logAllRefUpdates = true is added to the repository’s config file and a couple of commits are pushed, the error will no longer appear and the command will work as expected.