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

前端 未结 10 1915
一整个雨季
一整个雨季 2021-02-07 20:12

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:21

    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/

提交回复
热议问题