Reputation: 3164
Is it possible to add a list of files somewhere to a changelist or file or something, and to run git diff commit1 commit2 myListOfFiles
and to get the diff of just that list of files? Or is it possible to create a macro that expands to that list? and to be able to remove and add from that list or change it?
This would be super-useful for creating patches for just certain files, not having to type down the paths for all 20 files I want to diff.
Upvotes: 0
Views: 1189
Reputation: 13616
Simply do:
git diff commit1 commit2 -- $(cat /path/to/listfile)
You can alias this command by the following line to your .gitconfig
:
[alias]
listdiff = "!f() { git diff $1 $2 -- $(cat \"$3\"); }; f"
and call it with
git listdiff commit1 commit2 path/to/file
Upvotes: 1