反向git配置命令

时间:2017-05-09 13:36:40

标签: git

我继续使用^M显示这些令人讨厌的git diff插入符号。请注意,这些文件存储在Linux上,但是使用Samba共享网络通过Windows进行编辑。试图摆脱它们,我按照git-diff to ignore ^M执行了以下操作:

[Michael@devserver .git]$ git config --global core.whitespace cr-at-eol

虽然不再显示^M,但更糟糕的是git diff仍然显示该行不同,但由于^M已不再显示,因此两行的文字相同显示。

如何撤消core.whitespace cr-at-eol?我以为我能够看到git的配置文件中的更改,但不是这样。

[Michael@devserver .git]$ cat config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git@xxx.com:root/projextx.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

1 个答案:

答案 0 :(得分:1)

使用--global时,设置位于~/.gitconfig,而不是<repository>/.git/config
您也可以使用git config --show-origin -l查看此内容 如果你没有使用--global,但--local(或者没有,因为--local是默认值),它将出现在您要查找的文件中。

从该文件中删除它,或者更好地使用git config之类的git config --global --unset core.whitespace