0

I try to get a list of all commits which made changes to a certain file. Is this possible? It should be sorted by date.

git showAllChanges /path/to/file.xy

Output:

d9fc62dba13069fc281e9d09b698ba2e32f6dafd
2625eb741618dae7004b3d23a5894ae7a91df698
cfae25eced932c1375b3bc56ae8399ca88513d94
Black
  • 18,150
  • 39
  • 158
  • 271

2 Answers2

2

You can use git log:

git log --pretty=format:"%h" -- path/to/file.xy

The --pretty=format:"%h" allows you to get only minified commit hash. If you want the full hash, you can use %H. If you want more you can take a look at the pretty-formats documentation.

If you want to take filename change into account, you can use the --follow option.

Ulysse BN
  • 10,116
  • 7
  • 54
  • 82
1

Yes, it is possible, you have the git log command, as reported in the official documentation

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.

You can also pretty print the output with $ git log --pretty=oneline or $ git log --pretty=format:"%h - %an, %ar : %s"

Or limit time interval with git log --since=2.weeks.

There are a lot of parameters, check out the manual page. Here is the full documentation

Fjordo
  • 768
  • 3
  • 18
  • 40