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

前端 未结 20 1746
梦谈多话
梦谈多话 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:50

    I am assuming that you are asking how to remove ALL the files in a specific folder or the bin folder, Rather than selecting each files separately.

    You can use this command:

    git rm -r -f /\*

    Make sure that you are in the parent directory of the of that directory.
    This command will, recursively "delete" all the files which are in the bin/ or build/ folders. By the word delete I mean that git will pretend that those files are "deleted" and those files will not be tracked. The git really marks those files to be in delete mode.

    Do make sure that you have your .gitignore ready for upcoming commits.
    Documentation : git rm

提交回复
热议问题