fbpx

CuTt8: git branch by date

June 21, 2017

Copper’s Tips & Tricks #8: git branch by date

Here at the office we use feature branches. Feature branches with ticket name/numbers. Now, I am good at remembering numbers, but when I have to switch between different tickets I have no idea which one’s the one I was working on last.

Also, when you use the git branch command, you may be shown a long list of feature branches that can be old enough that you may as well delete it from your local repo.

That would be smart, but it requires thinking.

There’s always a better alternative to thinking: cheating. And this is the cheat I use for git branches:

git() {
  if [[ $@ == "branch" ]]; then command git branch --color=always --sort=-committerdate; else command git "$@"; fi;
}

It’s actually a bash function, because aliases with spaces aren’t supported. So just cat >> that into your .bash_profile file and you’ll be golden.

#TLDR: git branch --sort=-committerdate

Happy git date-branching!

avatar
Fabio Pampin

Ver entradas

Most Recent

June 9, 2022

¿Qué son las DAO y cuáles son sus beneficios?

Es común en la historia contemporánea que haya cambios a partir de los avances en el campo de la...

Read More

June 2, 2022

¿Qué son las DeFi y por qué son el futuro de las finanzas?

Es común en la historia contemporánea que haya cambios a partir de los avances en el campo de la...

Read More

May 27, 2022

How to start a successful product build from scratch?

Creating a product from scratch could be a huge challenge. To achieve your business goals it’s important to develop...

Read More