Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- I rarely care about the date of the commit on the branch to determine recency, I care about when I last switched to the branch.
This comment gets it correct https://news.ycombinator.com/item?id=49504860
I wrote my own version to do this nearly 10 years ago: https://github.com/amarshall/git-recent-branches
by amarshall - There's a bunch of these good ideas here: https://news.ycombinator.com/item?id=43169435by krautsauer
- Our team's `git branch` output is a graveyard. Sorting by last commit would be a godsend for quickly identifying active work and stale branches.by dalton74
- I have been using the `git lb` alias suggested by https://ses4j.github.io/2020/04/01/git-alias-recent-branches... (post written April 1st but not a joke) and quite enjoying it. Shows me the last 10 branches I worked on (very easy to edit the alias definition to get more or fewer than 10), sorted by date, most recent first. It's been handy in all sorts of situations, especially because one of our internal libraries needs a bugfix or a new feature every 3 months or so. So every time I cd into that repo, I have no clue what I did last, but `git lb` tells me right away.by rmunn
- The best upgrade to these kinds of git branch scripts is piping them to fzf. I’ve been using this fbr one from the fzf repo. https://github.com/jbranchaud/dotfiles/blob/main/zshrc.local...by jbranchaud
- Huge fan of `git recent` [0] for this purpose.by metmac
- 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!by ComputerGuru
- Even better (IMHO!) is `git config branch.sort -committerdate` (note the `-`). This will sort newest committer date first.by asb