ignoring any 'bin' directory on a git project

前端 未结 15 1626
暖寄归人
暖寄归人 2020-11-22 16:45

I have a directory structure like this:

.git/
.gitignore
main/
  ...
tools/
  ...
...

Inside main and tools, and any other directory, at an

相关标签:
15条回答
  • 2020-11-22 17:27

    In my case encoding of gitignore file was problematic, check if it is UTF-8

    0 讨论(0)
  • 2020-11-22 17:29

    I didn't see it mentioned here, but this appears to be case sensitive. Once I changed to /Bin the files were ignored as expected.

    0 讨论(0)
  • 2020-11-22 17:34

    I think it is worth to mention for git beginners:

    If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal:

    git rm --cached

    So if you want add to ignore some directories in your local repository (which already exist) after editing .gitignore you want to run this on your root dir

    git rm --cached -r .
    git add .
    

    It will basically 'refresh' your local repo and unstage ignored files.

    See:

    http://git-scm.com/docs/git-rm,

    https://help.github.com/articles/ignoring-files/

    0 讨论(0)
提交回复
热议问题