DEV Community

Cassidy Williams
Cassidy Williams

Posted on • Originally published at blog.cassidoo.co

59 3 2 4 2

Sorting Git branches

Normally when you run git branch on a repository, you get your list of branches in alphabetical order, which can be very annoying if you have a lot of them (unless you have a very rigid naming system by ticket number or something).

You can change that now!

In your repo, if you do:

git branch --sort=-committerdate
Enter fullscreen mode Exit fullscreen mode

This will sort all of your branches by the date of their last commit!

You can sort by:

  • authordate
  • committerdate
  • creatordate
  • objectsize
  • taggerdate

Plus, you can also do this globally if you want to always do it by one of these, like so:

git config --global branch.sort -committerdate
Enter fullscreen mode Exit fullscreen mode

Or, you could set an alias:

git config --global alias.brcd "branch --sort=-committerdate"
Enter fullscreen mode Exit fullscreen mode

Now go on and git committing!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (4)

Collapse
 
yogionbioinformatics profile image
Yogindra Raghav

Nice and short -- love these types of useful articles.

Collapse
 
joeattardi profile image
Joe Attardi

Great tip!

Collapse
 
murtuzaalisurti profile image
Murtuzaali Surti

awesome!

Collapse
 
c9hp profile image
C9

So short

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more