I have the following folder structure:
| folder1 
│   ├── file1
│   ├── file2
│   ├── file3
│   ├── file4
│   ├── file5
│   ├── fileN
| folder2 
│   ├── file1
│   ├── file2
│   ├── file3
│   ├── file4
│   ├── file5
│   ├── fileN
I would like to check the differences between files 1, 2, 5 and 15. Is there a way to use git diff to check the differences between these files, without being:
git diff folder1/file1 folder2/file1 
git diff folder1/file2 folder2/file2
git diff folder1/file5 folder2/file5
Is it possible to write the file names into a document and ask git to check the differences?
Best Regards
You can ask git diff to compare two trees (a "tree" is a directory in git technical terms, and represents an object in git's storage), and specify the files to compare afterwards :
git diff HEAD:folder1/ HEAD:folder2/ -- file1 file2 file5
You may try difftool -d, which will invoke an external diff viewer, and will probably offer a better UI experience :
git difftool -d HEAD:folder1/ HEAD:folder2/
# or :
git difftool -d HEAD:folder1/ HEAD:folder2/ -- file1 file2 file5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With