0

I'm experiencing the following situation:

user@host:~myproj$ git log . | head
commit 824982108230598203958209
Author: me <me@me>
Date:   Web Feb 14 00:17:13 2018+0100

   My comment of commit B

commit 215237562352395782927652
Author: me <me@me>
Date:   Web Feb 13 00:05:21 2018+0100

   My comment to last common commit C

user@host:~myproj$ git log inner/directory | head
commit 124975408286439738467394
Author: me <me@me>
Date:   Web Feb 14 10:08:35 2018+0100

   Comment to a more recent commit A

commit 215237562352395782927652
Author: me <me@me>
Date:   Web Feb 13 00:05:21 2018+0100

   My comment to last common commit C

That is if I run git log from root directory I see commit B and C, if I run git log from an inner directory I see commit A and C, with A more recent than B.

I'm also in the following situation:

user@host:~myproj$ git status
On branch master
Your branch is up-to-date with 'origin/master'
nothing to commit, working directory clean
user@host:~myproj$ git pull
Already up-to-date.
user@host:~myproj$ git push
Everything up-to-date

I thought that asking logs from root directory would have shown every commit in all sub-directory of the project; since now I see I'm wrong, how can I have a full list of commit history order by commit date?

Also, why this is happening? Is this a normal git behavior or am I m[ie]ssing something?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jack
  • 1,488
  • 11
  • 21

1 Answers1

1

It comes out that git log . is different from git log.

My question can be answered by simply issuing: git log, without specifying any path

Jack
  • 1,488
  • 11
  • 21
  • 1
    This is one of the odder corners of Git, by the way: `git log ` turns on what Git calls *history simplification*. Essentially, Git skips over some commits. This part is natural enough because `git log` does not mean *show me every commit ever* but rather *show me the commits that I've said are interesting based on arguments*. But the ones that this history simplification chooses as "interesting" turn out to be quite tricky! – torek Feb 14 '18 at 15:52
  • Excellent explanation @torek - You should post it as an answer. Thanks – Jack Feb 15 '18 at 08:56
  • See [this answer](https://stackoverflow.com/a/48819299/1256452) to a related question. – torek Feb 16 '18 at 02:32