我有git日志别名:
git log --reverse --oneline --pretty=format:'-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
但是我希望它也能被反转,因为有时需要滚动到顶部是不方便的。
将--reverse
从您已经拥有的命令中删除,即
git log --oneline --pretty=format:'-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
也许你出于某种原因想要多次反转,所以
your_command | perl -e 'reverse <>'
可以帮忙;)
或
your_command | tail -r
或@evnu建议
your_command | tac
或者当你想要反转每一行时,你可以
your_command | perl -nlE 'chomp;say scalar reverse'
尤其是最后一个是好的,例如:
date | perl -nlE 'chomp;say scalar reverse'
打印
3102 TSEC 32:95:91 41 yaM euT
ps:开玩笑的…:)