[Practical] Solve the problem that the .gitignore file does not take effect

Article directory

background

Target: .gitignorethe file does not take effect, even if a certain directory or file is added to the ignore rule

reason

  • .gitignoreCan only ignore files that were not originally tracked
  • If some files have already been included in the version management, then the modification .gitignoreis invalid.

Solution

Delete the local cache first (change it to an untracked state), and then submit

git rm -r --cached .
git add .
git commit -m 'update .gitignore'
git push -u origin master

































The paragraphs of the article are all wrapped in code blocks, and the message 0 is to avoid the low quality of the article prompt. The
paragraphs of the article are all wrapped in code blocks, and the message 1 is to avoid the low quality of the
article prompt. Comment 2 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and comment 3 is to avoid low-quality article prompts.
All paragraphs of the article are wrapped in code blocks, and comment 4 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks. The message 5 is to avoid the low quality of the article prompts. The
paragraphs of the article are all wrapped in code blocks, and the message 6 is to avoid the low quality of the article prompts
. Comment 7 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and comment 8 is to avoid low-quality article prompts.
All paragraphs of the article are wrapped in code blocks, and comment 9 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and the message 10 is to avoid the low quality of the article prompts. The
paragraphs of the article are all wrapped in code blocks, and the message 11 is to avoid the low quality of the article prompts
. Comment 12 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and comment 13 is to avoid low-quality article prompts.
All paragraphs of the article are wrapped in code blocks, and comment 14 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and the message 15 is to avoid the low quality of the article prompts. The
paragraphs of the article are all wrapped in code blocks, and the message 16 is to avoid the low quality of the article prompts
. Message 17 is to avoid low-quality article prompts.
The paragraphs of the article are all wrapped in code blocks, and the message 18 is to avoid the low quality of the article prompts. The
paragraphs of the article are all wrapped in code blocks, and the message 19 is to avoid the low quality of the article prompts.

Guess you like

Origin blog.csdn.net/al6nlee/article/details/130093261