Want to exclude file from “git diff”

后端 未结 13 1909
梦谈多话
梦谈多话 2020-12-07 07:27

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

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 07:56

    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.

提交回复
热议问题