I am trying to get a list of files that have changed on a branch since some date. This is what I have now:
git log --since="2022-10-13T17:40:05.232777" --name-only --pretty=format:'%f'
And that prints:
Even-more-test-files
python/tests_index/secondtestfile.txt
python/tests_index/teeeeeeeeeest.txt
More-test-files-for-git-log
python/findtest.py
Add-some-test-file
python/tests_index/testfile.txt
That's weird. The dash separated strings like More-test-files-for-git-log
are commit messages, except for some reason spaces are replaced with dashes. What I want is just this:
python/tests_index/secondtestfile.txt
python/tests_index/teeeeeeeeeest.txt
python/findtest.py
python/tests_index/testfile.txt
No commit messages. No extra newlines. Just a list of files that have changed via a commit on this branch since the date I have given.
How to fix the --pretty
argument so that I get what I want?
CodePudding user response:
--pretty=format:'%f'
The dash separated strings like
More-test-files-for-git-log
are commit messages, except for some reason spaces are replaced with dashes.
That's what you asked for:
%f sanitized subject line, suitable for a filename
How to fix the
--pretty
argument so that I get what I want?
Use --pretty=format:
(or --format=
).