How can I edit a git branch's description programmatically?

Viewed 42

I'd like to automatically set the description of a git branch using a bash function or something similar.

With git, it is possible to edit the description of a branch as follows:

git branch --edit-description

However, this opens a vim editor for modifying the description, which I would have to manually edit and then close out of, preventing me from automating the process.

Does anyone know of a way to do this programmatically, either using some sort of git command I'm unaware of or somehow piping input to the vim somehow?

1 Answers

I've figured it out. It's a simple git config value, so setting the description is as easy as:

git config branch.<branch_name>.description "Enter description here"
Related