I used almost all git log commands yet i haven't found a best way to do this. I need only this - get only file name with path nothing else
/path/filename.txt
/path/anotherfile.ext
...
...
My input is date FROM and TO to the git log command. Either git log gives developer-name or date or commit-number or something that i don't want with file names. How to get ONLY the file name with full path?
Use
--name-only
and remove the message with an empty formatJust use all other
git log
options as usual. E.g.Optionally sort and remove dupplicates
Use the
--since
and--until
options to select the time range and then you can use UNIX pipes togrep
,sort
and collect theuniq
e paths:Example:
For more detailed
git log
outputs see How to have git log show filenames like svn log -vIf you have to commit hashes, you can also use
git diff
and--name-only
instead, as the other answer mentions:This does not use
git log
, but if you're willing to use commit objects (hashes, branch references or other commitish identifiers),git diff
makes it simple. Example for getting the changed files for the last three commits.You can replace
HEAD~3
with either a single commitish so you're comparing to the current HEAD (the commit you're "on"), or then define a commit range with<commitish>..<commitish>
:If you need to filter the files according to the modification type (e.g. added, modified, deleted...), you can use the
--diff-filter
option.man git diff
:If you need to use dates for filtering, then this may not be the best option. Perhaps use
git log --since=...
to get the first hash for the date and pass it togit diff
?