0

Situation: I untrack some files keeping them locally. Files are removed from the index and kept in working tree. Then I commit and push to remote. Files will be deleted from remote repository.

What will happen to other people when they pull? Will their local file be deleted (like remote) or will they keep their local copy, untracked (like my working tree)?

Luke
  • 1,633
  • 3
  • 23
  • 37

2 Answers2

1

If other people pull the branch locally then, their local files will be deleted like remote since the files are deleted from remote.


git rm --cached remove the file(s) from staging area, so the file(s) become untracked (not known/handle by git anymore). After Commit, Push the file is deleted from the remote.

Like if you just create a new file a.txt but not Add, Commit, Push to remote (a.txt is a untracked file), then a.txt is totally unknown to other people when pulling locally.

Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
  • So adding `--cached` to `git rm` makes no difference to anyone else beside yourself. – Luke Sep 08 '17 at 09:30
  • Yes, `git rm --cached` remove the file(s) from staging area, so the file(s) become untracked (not known/handle by git anymore). After Commit, Push the file is deleted from the remote. – Sajib Khan Sep 08 '17 at 09:52
  • Like if you just create a new file `a.txt` but not Add, Commit, Push to remote (a.txt is untracked file), then `a.txt` is totally unknown to other people when pulling locally. – Sajib Khan Sep 08 '17 at 09:55
  • It's weird having an operation that behaves differently to your teammates' working trees... – Luke Sep 08 '17 at 12:52
1

To start ignoring the changes to the file

git update-index --assume-unchanged path/to/file

To start keeping track again

git update-index --no-assume-unchanged path/to/file