I am trying to find all the modified java file between two branches after the 1st of April. I could find all the modified java files with the following command. Is there anyway to apply date filter as well? Thanks
git --no-pager diff --name-only feature_branch..master | grep .java
Solution
Thanks @romainvaleri. I used the following command to identify the modified Java files.
git log --since="1st April" --name-only --pretty=format:"" feature_barnch..master -- *.java | sort -u | sed 's/.*\///'
I'd rather use git log
here for its convenient options :
git log --since="1st April" --name-only --pretty=format:"" feature_branch..master -- *.java
Where :
--since=<date>
lets you set the date filter¹
--name-only
shows only changed file names in place of changes
--pretty=format:""
suppresses all output (namely, commit info) but the diff
feature_branch..master
sets the range of commits to cover
and finally
-- *.java
filters along file names
Then, if in bash context, you'll probably want to cure the list with | sort
and | uniq
git log --since="1st April" --name-only --pretty=format:"" feature_branch..master -- *.java | sort | uniq
¹ (which could have been relative, let's say --since="one month ago"
)