How to stop tracking and ignore changes to a file in Git?

前端 未结 20 2170
梦谈多话
梦谈多话 2020-11-21 07:17

I have cloned a project that includes some .csproj files. I don\'t need/like my local csproj files being tracked by Git (or being brought up when c

20条回答
  •  不要未来只要你来
    2020-11-21 07:55

    To tell Git not to track changes to your local file/folder (meaning git status won't detect changes to it), do:

    git update-index --skip-worktree path/to/file
    

    And to tell Git to track changes to your local version once again (so you can commit the changes), do:

    git update-index --no-skip-worktree path/to/file
    

提交回复
热议问题