2

Say I have a file foo.bar which is tracked by git and at some point I want my local repository to ignore the changes I make to this file. This is, if I understand correctly, the case to use (link1;link2)

git update-index --assume-unchanged foo.bar

My question is, what happens with this file in case there are changes on a remote repository? Will the changes be reflected in my local copy?

This answer suggests the same solution - but the comment which address my question was left unanswered...

Community
  • 1
  • 1
Dror
  • 12,174
  • 21
  • 90
  • 160
  • Why not you try it yourself. I remember git will stop the pull action if any conflict. – pktangyue May 30 '13 at 02:36
  • Unfortunately this is a much misunderstood feature. It is not about ignoring changes, rather it is telling Git that it doesn't need to check because you are NOT changing it. It was designed for systems with slow file status system calls such as cifs. A change to the documenation is in progress. – Philip Oakley Dec 11 '14 at 15:31

1 Answers1

4

The "assume-unchanged" bit is stored in your index, not in the repository itself. Thus fetch/pull/push do not propagate that setting to or from other repositories, which means it is a local setting. Users of other clones of the repository may very well create new commits involving that file. I'm not sure there's a "simple" answer regarding how to deal with this scenario, as it depends on what exactly you're trying to do, and what is being done in other repositories.

twalberg
  • 59,951
  • 11
  • 89
  • 84