Git Branch Descriptions

Here's a neat little feature of git that I just learnt about. It turns out that git branches can have associated descriptions, although they are local only. All you have to do to set one is to run the command `git branch --edit-description` which will open your editor, just like writing a commit message. To view the git branch's description you run the command `git config branch.<name>.description`, i.e. `git config branch.main.description` for the main branch. This can be shortened to `git config branch.`gb`.description` if you have a shell function `gb` defined as `git branch --show-current`; a handy little shortcut for commands like `git push -u origin `gb``, where you need a reference to the current branch rather than HEAD.


Last Updated: 2022-07-16