Excluding files from git-diff

后端 未结 4 1967
情话喂你
情话喂你 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:06

    You may use an alias in your .git/config

    [alias]
            mydiff = !git diff | filterdiff -x "*/Project.xcodeproj/*"
    

    You need filterdiff (from patchutils) for this trick.

    sudo apt-get install patchutils
    

    Still the diff isn't perfect, it leaves some garbage :

    yannick@yannick-desktop:~/git-filter-test$ git mydiff
    diff --git a/Project.xcodeproj/dummy.txt b/Project.xcodeproj/dummy.txt
    index 3e1f9e6..89dfed9 100644
    diff --git a/dummy2.txt b/dummy2.txt
    index 91966ce..d9588a9 100644
    --- a/titi.txt
    +++ b/titi.txt
    @@ -1,3 +1,3 @@
     aaaaaaaaaa
    -bbbbbbbbb
     cccccc
    +ffffd
    

提交回复
热议问题