As an experiment, I made a post-commit hook that stores information about the currently checked out branch in the commit metadata. I also slightly modified gitk to show that information.
You can check it out here: https://github.com/pajp/branch-info-commits