Doug Smith
Doug Smith

Reputation: 29314

When I have git log print out as oneline, how do I reverse it?

I have git log aliased to this:

git log --reverse --oneline --pretty=format:'-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

But I want it to be reversed as well, as sometimes it's inconvenient to have the top needed to be scrolled to.

Upvotes: 0

Views: 145

Answers (2)

clt60
clt60

Reputation: 63912

maybe you for some reason want reverse it more times, so the

your_command | perl -e 'reverse <>'

can help ;)

or the

your_command | tail -r

or as @evnu suggest

your_command | tac

or when want reverese each line, you can

your_command | perl -nlE 'chomp;say scalar reverse'

especially the last is good, for example:

date | perl -nlE 'chomp;say scalar reverse'

prints

3102 TSEC 32:95:91 41 yaM euT

ps: kidding only.. :)

Upvotes: 1

parkydr
parkydr

Reputation: 7784

Take the --reverse out of the command you already have i.e.

git log --oneline --pretty=format:'-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

Upvotes: 2

Related Questions