开发者

Git: Have one user not fetch/merge changes to specific, otherwise tracked, files

We have a file that we need to be tracked in our Git repository. Most users need to be using this file as normal: committing changes to it, pushing, pulling, etc…

We have one user for whom this file causes various computer iss开发者_JS百科ues, and never uses this file regardless. We want this user's repo to "skip" dealing with this file altogether.

Whatever's in there now is OK to stay, but new changes to it shouldn't be fetched.

I tried removing the cached version and setting it to ignore, but changes to locally-ignored files still get fetched and merged.

Does anybody know how to accomplish this?

Thanks so much!

-Matt


You can try a git filter driver:

Git: Have one user not fetch/merge changes to specific, otherwise tracked, files

with a smudge/clean script:

  • able to detect the problematic content
  • replace it ('smudge') by the current content (saved as another file, ready to replace the dangerous content of the problematic file)
  • restore the originally fetched content on commit ('clean')

That filter driver would be declared in a .gitattribute file visible only in the branch in which the user has to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜