jmtd → log → Small tweaks to `git branch` behaviour
Despite my best efforts, I often end up with a lot of branches in my git
repositories, many of which need cleaning up, but even so, may which don't.
Two git
configuration tweaks make the output of git branch
much more
useful for me.
Motivational example, default git
behaviour:
🍊git branch
2021-apr-cpu-proposed
OPENJDK-159-openj9-FROM
OPENJDK-312-passwd
OPENJDK-407-dnf-modules-fonts
create_override_files_in_redhat_189
* develop
inline-container-yaml
local-modules
mdrafiur-pr185-jolokia
openjdk-containers-1.9
openjdk-rm-jolokia
osbs-openjdk
release
signing-intent-release
ubi-1.3-mergedown
ubi-11-singleton-jdk
ubi8.2
update-FROM-lines
update-for-cct-module-changes-maven-etc
The default sort order is alphabetical, but that's never useful for the
repositories I work in. The age of the branch is generally more useful.
This particular example isn't that long, but often the number of branches
can fill the screen. git
can be configured to use columns for branch
listings, which I think generally improves readability.
🍊git config --global branch.sort authordate
🍊git config --global column.branch auto
After:
🍊git branch
update-for-cct-module-changes-maven-etc signing-intent-release
openjdk-rm-jolokia local-modules
ubi8.2 mdrafiur-pr185-jolokia
ubi-11-singleton-jdk OPENJDK-312-passwd
ubi-1.3-mergedown create_override_files_in_redhat_189
OPENJDK-159-openj9-FROM 2021-apr-cpu-proposed
openjdk-containers-1.9 OPENJDK-407-dnf-modules-fonts
inline-container-yaml release
update-FROM-lines * develop
osbs-openjdk
Comments