I am trying to exclude a file (db/irrelevant.php
) from a Git diff. I have tried putting a file in the db
subdirectory called .gitattributes>
If you want to do this only to visually inspect the diff, a visual diff tool (like Meld) will let you do it with a short command that's easy to remember.
First, set up a diff tool if you haven't already.
$ git config --global diff.tool = meld
Then, you can run a directory diff.
$ git difftool --dir-diff
You'll be able to browse diffs (by file) in Meld (or your tool of choice). Simply don't open the file you want to ignore.