How can I stop .gitignore from appearing in the li

2020-01-23 04:51发布

I just did a git init on the root of my new project.

Then I created a .gitignore file.

Now, when I type git status, .gitignore file appears in the list of untracked files. Why is that?

19条回答
甜甜的少女心
2楼-- · 2020-01-23 05:24

Watch out for the following "problem" Sometimes you want to add directories but no files within those directories. The simple solution is to create a .gitignore with the following content:

*

This seams to work fine until you realize that the directory was not added (as expected to your repository. The reason for that is that the .gitignore will also be ignored, and thereby the directory is empty. Thus, you should do something like this:

*
!.gitignore
查看更多
登录 后发表回答