This would be a completely different approach than git note but you could use git config for this function.
$ git config branch.<branch-name>.note 'This is what this branch is for'
It could be an alias to make the interface easier (I think it can be improved, but this is what I use):
$ git config alias.branch-note '!git config branch.$(git symbolic-ref --short HEAD).note $( if [ $# -gt 0 ]; then $1; fi)'
This allows you to set the note for the branch as follows (make sure you specify in the note):
$ git branch-note 'This is what this branch is for'
Then you can get the current note branch as follows:
$ git branch-note This is what this branch is for
As an added benefit, the configuration entries defined in branch.<branch-name> of branch.<branch-name> names branch.<branch-name> will follow the renaming of the branch and will be automatically cleared if you delete the branch later. These extra configuration entries will only be saved as long as the branch exists, at which point they will be automatically deleted.
The disadvantage of this approach is that you can only store one โnoteโ for each branch. Subsequent branch calls with an argument will overwrite the previous branch. You also do not benefit from storing the message in a monitored git object, but perhaps this will be enough for your purposes.
Brian Phillips Jan 21 '11 at 4:01 2011-01-21 04:01
source share