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

前端 未结 20 2186
梦谈多话
梦谈多话 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 prevent monitoring a file by git

    git update-index --assume-unchanged [file-path]
    

    And to revert it back use

    git update-index --no-assume-unchanged [file-path]
    

    A repo to refer for similar use cases https://github.com/awslabs/git-secrets

提交回复
热议问题