Technology1 min read

Sort git branches by date

By · Published by Everything Blog

In short

To do this, you can use the `git config` command with the `--global` option and the `branch.sort` parameter set to `-committerdate`. This will sort your branches by the date of the last commit, with the most recent commit appearing first.

Key points

  • Use `git config --global branch.sort -committerdate` for tracking changes.: Use `git config --global branch.sort -committerdate` for tracking changes.
  • Reset configuration with `git config --global branch.sort --unset`.: Reset configuration with `git config --global branch.sort --unset`.

Sources checked by our analysis pipeline: 1

I’m sure everyone is already doing this, but I’ve just discovered:

git config --global branch.sort -committerdate

Now, `git branch` sorts my branches by last commit date, most recent first.

To reset:

git config --global --unset branch.sort

Original source: akrabat.com

Technology