Git: Ignoring Version-Controlled Files

前端 未结 6 2105
遇见更好的自我
遇见更好的自我 2020-11-28 23:13

The .gitignore file is very useful in ignoring some of the files that we don\'t want to control. Unfortunately, it cannot be used when the file is already under version cont

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 23:53

    I've written about three ways of excluding files elsewhere.

    In summary:

    1. A global git ignore file applies to all repositories on that system
    2. The .gitignore file in the repository applies the the repository and all clones of that repository.
    3. The .git/info/exclude file applies only to that repository.

    The lower items in the list have priority over the higher items, and a ! in front of an item in any of the patterns in the file reverses a previous exclusion.

    This paradigm is seen elsewhere in Git. For example, if you were using submodules, the url to the submodule to use is in the the .gitmodules file in the repository, but you can over-ride the url to use in the .git/config file.

提交回复
热议问题