0

In GIT in the command line I see I have a modified file:

#   modified:   sites/sites.php

I want to not commit this, but I want this file to only be excluded locally. Ive opened the file called exclude in .git/info and added this line:

sites/sites.php

Ive reverted the modifications to the file so I have nothing to commit. Ive made the change again and it shows up in GIT in the terminal again as a change. Have I done something wrong?

Evanss
  • 23,390
  • 94
  • 282
  • 505
  • Will this affect the repo for other users? I need to only ignore local changes on one machine. – Evanss Feb 27 '15 at 10:05
  • 1
    possible duplicate of [git ignore files only locally](http://stackoverflow.com/questions/1753070/git-ignore-files-only-locally) – nwinkler Feb 27 '15 at 10:07
  • @nwinkler I tried following the instructions from the accepted answer from that link. – Evanss Feb 27 '15 at 10:09
  • possible duplicate of [git: can i commit a file and ignore the content changes?](http://stackoverflow.com/questions/3319479/git-can-i-commit-a-file-and-ignore-the-content-changes) – Sascha Wolf Feb 27 '15 at 11:06

1 Answers1

3

To locally ignore the file:

 git update-index --assume-unchanged <file>
svlasov
  • 9,923
  • 2
  • 38
  • 39