git添加本地过滤文件

左手 posted @ 2012年10月16日 21:16 in 积累点滴 with tags git 版本控制 git config git config core.excludesfile , 2702 阅读

项目开发中,有时需要添加一些本地的过滤文件,不提交到仓库中。可以采用以下方式

1.git config core.excludesfile .localgitignore

2.创建 .localgitignore 文件中添加需要过滤的内容

3.在默认的 .gitignore 文件中过滤 .localgitignore

Avatar_small
依云 说:
2012年10月16日 21:46

这样设置是全局的。如果要针对特定的项目,可以写到 .git/info/exclude 文件中。

Avatar_small
doyle 说:
2012年10月17日 13:21

请问和直接使用.gitignore有啥区别么?

Avatar_small
左手 说:
2012年10月17日 20:07

依云大大,我专门跑到本地的项目看了一遍git config 是针对当前项目的,不是全局的呀。修改的是 project/.git/config 这个文件,不是 ~/.gitconfig 这个文件呢 @依云:

Avatar_small
左手 说:
2012年10月17日 20:15

和直接使用.gitignore没什么区别的。我这边的场景是,多人开发项目的时候有一份全局的 .gitignore 本地还需要一份针对个别开发人员的过滤文件。@doyle:

Avatar_small
依云 说:
2012年10月17日 21:16

@左手: 啊,我弄错了……原来 .git/config 里也有这个选项。不过还是没有 .git/info/exclude 干净。不知道这样能不能在设置的文件中过滤自己而不修改 .gitignore 呢?

Avatar_small
左手 说:
2012年11月04日 17:07

@依云: 可以在 .localgitignore 文件中添加 .localgitignore 来实现过滤文件本身的。呵呵!

Avatar_small
依云 说:
2012年11月04日 17:20

@左手: 这主意不错 :-)

Avatar_small
seo service UK 说:
2024年1月16日 16:37

What a really awesome post this is. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up

Avatar_small
seo service UK 说:
2024年2月24日 14:55

This is exciting, nevertheless it is vital for you to visit this specific u


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter