gitignore just doesn't work. I can't get it to ignore .DS_Store & .gitignore files

前端 未结 10 785
心在旅途
心在旅途 2021-02-07 19:40

I have .gitignored .DS_Store and .gitignore files. But still see them in the \"git status\".

Can someone explain to me how I can m

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 20:27

    If you want to ignore a change to a file that is tracked by git you can specify to git that it should assume that the file has not changed:

    git update-index --assume-unchanged file
    

    and to start tracking changes again do:

    git update-index --no-assume-unchanged file
    

    if you have already added a file that should be completely ignored (.gitignore) you have to git rm it first.

    reference: https://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
    source: http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files/

提交回复
热议问题