Git: untrack a file in local repo only and keep it in the remote repo

git

Solution

You could update your index:

cd /root/folder/of/your/repo
git update-index --assume-unchanged nbproject/project.properties

and make sure it never shows as "updated" in your current repo. That means it won't ever be pushed, but it is still present in the index. (and it can be modified at will in your local working tree).

- to revert that state (from git-ready):

`git update-index --no-assume-unchanged <file>`

- to see all assume unchanged files (from Gabe Kopley's comment)

`git ls-files -v | grep '^h '`

Problem

I have a NetBeans file "nbproject/project.properties" that always shows up in the "Changes not staged for commit" section (when I do git status). How could I move this to the Untracked files section (without adding it to .gitignore) ? I tried this command `git rm --cached` but what happened is the file shows as untracked in my local repo and got removed in the remote one but what I want is to keep it in remote and untrack only in local repo.

Original source

Related problems