How to Show Commits Oldest-First with git log –reverse
Without any options, git log lists commits from newest to oldest. Adding --reverse flips the order so you can read commits from oldest to newest. It is useful for finding the first commit in a repository, or for rereading the changes on a branch in the order they were stacked before reviewing a pull request. I ran the git commands in a test environment and show the output before and after adding --reverse as is.
The test environment is Ubuntu 24.04 with Git 2.43.0. All author names and email addresses are example values, and the author and commit dates were set with environment variables. The pager is disabled. I did not test on Windows or macOS, or how history is displayed on services such as GitHub.
- 1. Comparing the order with and without the option
- 2. Combined with -3, the newest 3 commits are shown in reverse
- 3. Showing the first commit of a repository
- 4. Limiting by date, author, or file, then sorting oldest-first
- 5. Reading the commits on a branch in the order they were stacked
- 6. Cannot be used with –graph or -g
Comparing the order with and without the option
For testing, I made six commits, one per day from November 1 to November 6. First, I displayed them without --reverse. The newest commit is at the top.
$ git log --oneline
5bbee3d ログイン画面に「記憶する」を追加
c166c82 READMEに使い方を追加
fc14b28 ログイン画面にパスワード欄を追加
94464a2 トップ画面を追加
438315e ログイン画面を追加
e563966 最初のコミット
With --reverse, the same six commits were listed in the opposite order. The first commit is at the top.
$ git log --oneline --reverse
e563966 最初のコミット
438315e ログイン画面を追加
94464a2 トップ画面を追加
fc14b28 ログイン画面にパスワード欄を追加
c166c82 READMEに使い方を追加
5bbee3d ログイン画面に「記憶する」を追加
The git log reference says that without options, commits are shown in reverse chronological order, and that --reverse outputs the commits shown in the reverse order.
Using --format to show the date and author confirms that the commits are in oldest-first order.
$ git log --reverse --format="%h %ad %an %s" --date=short
e563966 2026-11-01 Neko 最初のコミット
438315e 2026-11-02 Tama ログイン画面を追加
94464a2 2026-11-03 Neko トップ画面を追加
fc14b28 2026-11-04 Neko ログイン画面にパスワード欄を追加
c166c82 2026-11-05 Tama READMEに使い方を追加
5bbee3d 2026-11-06 Neko ログイン画面に「記憶する」を追加
The order is also reversed in the normal format, without --oneline. I show only the first 12 lines.
$ git log --reverse | head -n 12
commit e5639665d087edf66b4a5c0d6760c5eec4b83069
Author: Neko <neko@example.com>
Date: Sun Nov 1 10:00:00 2026 +0900
最初のコミット
commit 438315ec2d0b2519459b01420fb2cff2dac3efe5
Author: Tama <tama@example.com>
Date: Mon Nov 2 10:00:00 2026 +0900
ログイン画面を追加
Combined with -3, the newest 3 commits are shown in reverse
If you want to see only the oldest three commits and type git log --reverse -3, you will not get the result you expect. In my test environment, it showed the newest three commits in oldest-first order, not the first three commits.
$ git log --oneline -3
5bbee3d ログイン画面に「記憶する」を追加
c166c82 READMEに使い方を追加
fc14b28 ログイン画面にパスワード欄を追加
$ git log --oneline --reverse -3
fc14b28 ログイン画面にパスワード欄を追加
c166c82 READMEに使い方を追加
5bbee3d ログイン画面に「記憶する」を追加
The reference says that the options for limiting commits by count or date (Commit Limiting) are applied before the options that change the order, such as --reverse. -3 first selects the newest three commits, and then those three are reversed, which explains the result.
To see the first few commits, don't use -n. Instead, pass the output of --reverse to head.
$ git log --oneline --reverse | head -n 3
e563966 最初のコミット
438315e ログイン画面を追加
94464a2 トップ画面を追加
Showing the first commit of a repository
Using the same approach as above, head -n 1 shows only the first commit.
$ git log --oneline --reverse | head -n 1
e563966 最初のコミット
You can also do this without --reverse, using --max-parents=0. This option limits the output to commits with no parents (root commits), and the first commit has no parent.
$ git log --oneline --max-parents=0
e563966 最初のコミット
The reference says that --max-parents=0 shows all root commits. In a repository with two or more root commits, it will not show only one.
Limiting by date, author, or file, then sorting oldest-first
Filtering options are also applied before --reverse. When you filter by date, author, or file, the selected commits are the same regardless of the order, so the filtered result is listed oldest-first as is.
I used --since to show only commits from November 4 onward.
$ git log --oneline --reverse --since="2026-11-04 00:00"
fc14b28 ログイン画面にパスワード欄を追加
c166c82 READMEに使い方を追加
5bbee3d ログイン画面に「記憶する」を追加
I used --author to show only Tama's commits.
$ git log --oneline --reverse --author=Tama
438315e ログイン画面を追加
c166c82 READMEに使い方を追加
If you put a file path after --, only the commits that changed that file are listed oldest-first. You can follow how src/login.txt changed from when it was created.
$ git log --oneline --reverse -- src/login.txt
438315e ログイン画面を追加
fc14b28 ログイン画面にパスワード欄を追加
5bbee3d ログイン画面に「記憶する」を追加
Reading the commits on a branch in the order they were stacked
I created a feature/search branch from main and made three commits from November 7 to November 9. The authors and dates were set with environment variables, as before.
$ git switch -q -c feature/search
$ printf "検索\n" > src/search.txt && git add . && git commit -q -m "検索画面を追加"
$ printf "検索(絞り込み)\n" > src/search.txt && git add . && git commit -q -m "検索に絞り込みを追加"
$ printf "検索(絞り込み・並び替え)\n" > src/search.txt && git add . && git commit -q -m "検索結果の並び替えを追加"
As the revision specification reference describes, main..feature/search shows only the commits that are in feature/search but not in main. With --reverse, they were listed in the order they were made on the branch (search screen → narrowing → sorting). This is handy when you want to reread the changes one at a time.
$ git log --oneline main..feature/search
2f04172 検索結果の並び替えを追加
f8e3db7 検索に絞り込みを追加
374c2d2 検索画面を追加
$ git log --oneline --reverse main..feature/search
374c2d2 検索画面を追加
f8e3db7 検索に絞り込みを追加
2f04172 検索結果の並び替えを追加
Cannot be used with –graph or -g
When combined with --graph, which draws the commit history as a text graph, the command failed with an error and displayed nothing. The exit code was 128.
$ git log --oneline --reverse --graph; echo "exit=$?"
fatal: options '--reverse' and '--graph' cannot be used together
exit=128
It also cannot be combined with -g (--walk-reflogs), which walks the reflog. This is also noted in the description of --reverse in the reference.
$ git log --oneline --reverse -g; echo "exit=$?"
fatal: options '--reverse' and '--walk-reflogs' cannot be used together
exit=128





