Live data from Hacker News

Git alias for printing recently-used branches

ses4j.github.io

21–25 of 25 posts

Re: Git alias for printing recently-used branches

#21
post #6
post #2

I alias 'git recent' to: git branch --sort=-committerdate -v It gives me the following output (first line for not actually included): [branch name] [hash] [commit message header] move-radio-and-checkbox-hints-up 9dff690 Move the hints belonging to radios/checkboxes up update-rubocop 8cace1f Update rubocop and pry, fix some new offences fix-remaining-injected-content-placement 48dc51d Reorder elements of other inputs

This is much better as it’s portable and doesn’t cheat by assuming awk/grep/etc are available.

Honest question, what kind of environments are you working in where you don't / can't have these?

Re: Git alias for printing recently-used branches

#23
post #6

Earlier quoted context omitted.

This is much better as it’s portable and doesn’t cheat by assuming awk/grep/etc are available.

Honest question, what kind of environments are you working in where you don't / can't have these?

Windows (cmd/powershell).

It wouldn’t surprise me if windows cmd is the most common environment for git on command line, since windows is the most common OS among developers (and git-bash is terrible).

Re: Git alias for printing recently-used branches

#24

I had idea to add something similar as tab completion to posh-git module for Powershell. Sadly it was not merged (is posh-git dead?) https://github.com/dahlbyk/posh-git/pull/641 I wonder if something similar can be done in bash? By default bash doesn't "cycle" through possible completion but just display the list. Still, I guess it would be usefull to display last used branches first.

It doesn't seem to be dead. There was a PR commit only a week ago. You probably should poke the author again.

Re: Git alias for printing recently-used branches

#25
I made a small script that outputs local and/or remote branches color coded: https://i.imgur.com/QkmPhm0.png

https://github.com/bhaak/dotfiles/blob/master/git/git-overvi...

It has been so useful to me that I think I should extract it from my dotfiles repository and give it its own repository.

Or reimplement it in Rust as a introductory programming project.

Post reply on HN