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

后端 未结 1 1892
耶瑟儿~
耶瑟儿~ 2020-12-02 05:52

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 co

相关标签:
1条回答
  • 2020-12-02 06:45

    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 '

    0 讨论(0)
提交回复
热议问题