Why is git ignoring my changed file?

前端 未结 9 1140
南旧
南旧 2021-02-04 05:22

I make an arbitrary change to a file within my git working directory.

git status does not recognized that the file has changed.

git add /path

9条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 05:59

    There are two general reasons why Git will ignore a file: gitignore and submodules.

    To be more specific, the following conditions will cause Git to ignore a file when 'git add' is invoked:

    1. The file matches a pattern in $GIT_DIR/exclude.
    2. The file matches a pattern in a .gitignore file inside the repo.
    3. The file matches a pattern in a user-specific .gitignore file (specified by 'git config --global core.excludesfile').
    4. The file is part of a submodule.

    More info can be found in another SO question:

    Unable to track files within Git submodules

提交回复
热议问题