How to git log in reverse order?

前端 未结 5 1484
借酒劲吻你
借酒劲吻你 2021-01-30 05:43

I recently learned that I can get hg log to print the history in reverse order with:

hg log -r :

So of course I tried:

git log          


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 06:28

    You don't need to type --reverse all the time, nor do you need a bash function. You can just create a git alias. Open up your favorite text editor and open up your global .gitconfig file. It's usually found in your home directory.

    Navigate to or create a section like this:

    [alias]
        lg = log -10 --reverse
    

    That creates a git alias that grabs the ten most recent commits then reverses that list so the most recent of those 10 is at the bottom. Now you can simply run:

    git lg

提交回复
热议问题