DEV Community

Cover image for List git branches ordered by date of last commit
Nick Raphael
Nick Raphael

Posted on • Updated on

List git branches ordered by date of last commit

First day back after Christmas break and I'm a bit hazy on what I was working on. I know I was working on an area of code weeks ago but not sure if it got merged into Master.

Git can help. I'll list all my local branches by descending commit date. Luckily my branch names are taken from my workitem id.

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

I found the branch I was after near the top of the list. I then checked if the last commit on that branch was in master. Easy.

One to remember...

Top comments (0)