Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to git log in reverse order?

Tags:

git

git-log

People also ask

How do I revert git log?

You can press q to exit. git hist is using a pager tool so you can scroll up and down the results before returning to the console.

Is git log in chronological order?

The most basic and powerful tool to do this is the git log command. By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first.

How do I commit a git log?

On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.

What is git log -- Oneline?

Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.


Use the --reverse option:

git log --reverse

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


Jakub Narębski's comment ("Note that e.g. git log -10 --reverse would get 10 last commits then reverse list") has been clarified in Git 2.11 (Q4 2016):

See commit 04be694 (27 Sep 2016) by Pranit Bauva (pranitbauva1997).
(Merged by Junio C Hamano -- gitster -- in commit 54a9f14, 11 Oct 2016)

rev-list-options: clarify the usage of --reverse

Users often wonder if the oldest or the newest n commits are shown by log -n --reverse.
Clarify that --reverse kicks in only after deciding which commits are to be shown to unconfuse them.

See Commit Limiting.


None of above work... except this one with recent commit message + stats

git log --graph --stat

More snippet ~/.gitconfig:

lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
lg3 = log -10 --reverse --abbrev-commit