logoalt Hacker News

Sort branches by last commit date

36 pointsby speckxlast Tuesday at 2:57 PM12 commentsview on HN

Comments

asbtoday at 7:43 PM

Even better (IMHO!) is `git config branch.sort -committerdate` (note the `-`). This will sort newest committer date first.

show 1 reply
metmactoday at 9:00 PM

Huge fan of `git recent` [0] for this purpose.

[0] - https://github.com/paulirish/git-recent

show 1 reply
ComputerGurutoday at 8:42 PM

FYI/fwiw Fish shell autocompletes branches sorted by last commit date when writing out git commands. It also provides completions for commitish objects grouped by class, giving precedence to the usual targets first, with each group sorted by its own sort key. Handy!

tomtom1337today at 8:58 PM

I love this little fzf bash function that I wrote a few years ago: https://gist.github.com/thomasaarholt/141df779f3f16b641701b4...

It opens a fuzzy finder window showing the branches you have in the repo, sorted by recency. Also shows the latest committer and the date. Hit enter on the one you want to swap to it.

zahlmantoday at 8:48 PM

How many branches would you need to have to make this worthwhile?

show 2 replies
monster_trucktoday at 8:54 PM

I just click on tower and open it, much better

woodruffwtoday at 9:07 PM

Another useful one if you have a large number of tags and want to see the most recently created ones first:

    git config --global tag.sort -creatordate
(`-creatordate` reverses the sort so that the newest come first.)
bewareofscamstoday at 8:01 PM

Or just have `jj log` custom-configured.