-3

How can I prevend to be touched a particular file also if I checkout a branch where there is this file. I tried with gitignore but it there is in the branch it will be overwrite.

Tobia
  • 9,165
  • 28
  • 114
  • 219
  • 2
    Possible duplicate of [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – isherwood Mar 22 '19 at 16:03

1 Answers1

0

To prevent changes from being tracked after you ignore the file you'll need to tell Git to remove it from tracking:

git rm --cached <file>

If you're asking how to block changes to a file, Git doesn't do that.

isherwood
  • 58,414
  • 16
  • 114
  • 157