Git branch descriptions

I often have quite a few branches open and although my branchList command has stood me in good sted for a long time now I would like to add notes or descriptions to a branch.

alias branchList='git for-each-ref --sort=committerdate refs/heads/ --format='\''%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(content color:green)%(committerdate:relative)%(color:reset))'\'''

I don't really want to make the branch names overly long. I find that the commit messages aren't always good enough to tell me the purpose of the branch.

I guess this might just be bad practice on my part that the full information around why I created a branch cant be derived from the name and last commit message alone.

Recently I found out a way to add descriptions to branches so that I can add more information as to why I would be creating a branch and what the full scope of the work I was doing on that branch was.

This has lead to a new alias for me:

alias describebranch="git config branch.$(git rev-parse --abbrev-ref HEAD).description"

Obviously, I don’t type out describebranch when I want the description descr<tab> is sufficient.

To add the description to the current branch I simply:

Git branch --edit-description

I think I will find this mighty useful going forward.

It has also inspired me to find a better way to manage my git branches in the command line.

There are some extra tools I would like.

  • I would like a number based system to chose a branch from branchList.
  • I would like to be able to have an easy way to find the changes on a branch since it branched off of Master or any other branch for that matter.


Popular posts from this blog

An exploration in number systems

Structural engineering with cardboard

The twelve fold way