Excluding files from git-diff

后端 未结 4 1971
情话喂你
情话喂你 2020-12-13 03:52

I am tracking a project with git. There are some Xcode project files in the working copy that I want to keep tracking, but do not want to see in diffs, because there are alw

4条回答
  •  情话喂你
    2020-12-13 04:07

    Another solution that produces clean output without any external tools (add to .git/config):

    [alias]
        mydiff = !git diff -- $(git diff --name-only | grep -Ev "Project.xcodeproj/")
    

    Then run it with:

    git mydiff
    

    Note that git diff --name-only is better than git ls-files because it will pass a shorter list of files to git diff, since only files that are modified will be included. I've run into trouble with exceeding the maximum number of arguments in large projects when using git ls-files.

提交回复
热议问题