Get the latest tech news

Sort branches by last commit date


TIL: Sort branches by last commit date I have too many git branches and like many people I developed a convoluted script to show me the most recent ones. I ran this command many times a day for years: function branches { for k in `git branch | sed "s/^..//"`; do echo -e `git log --color -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" "$k"`\\t"$k"; done | sort } This outputs the date as the first column in the output so that sort works.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of sort

sort

Photo of branches

branches

Photo of commit date

commit date

Related news:

News photo

What sort of maths are LLMs good at?

News photo

Kingdom Come Salvation may be the next Medieval RPG from Warhorse, and it could have some sort of multi-player functionality, too

News photo

Giant trees have no trouble pumping water to top branches: new research