Reputation: 10536
Let's say we observe Linux kernel git repository.
I would like to discover exact dates of introduction of following directories:
arch/alpha
arch/arc
arch/arm
arch/arm64
.
.
.
arch/xtensa
to the master branch.
I am not familiar with git, and couldn't understand handling dates in git well.
I tried something with switch --diff-filter=A
for git log
, but it did not work as I wished.
Upvotes: 1
Views: 33
Reputation: 35911
Being on the master branch you can just do:
git log --reverse arch/alpha
and for each of the folders you're interested in. This will give you the first commit at the top. The --diff-filter=A
flag will additionally filter the results so still might be helpful, so you'll see all files added to this folder (including the first one added along with the folder).
There is an option -n <number>
, which would be helpful in limiting the output only to the single, oldest commit, but unfortunately the documentation explains it won't work:
Note that these are applied before commit ordering and formatting options, such as --reverse.
You can however additionally filter the output with tools in your shell.
Upvotes: 2