Shawn's blog Shawn's blog
About Me
  • Category
  • Tag
  • Archive
GitHub (opens new window)

Shawn Jin

I am not a creator of knowledge, I am just a porter of knowledge.
About Me
  • Category
  • Tag
  • Archive
GitHub (opens new window)
  • Python

  • Git

    • Force Git Pull and Ignore Local Change
    • Git .gitignore doesn't work after update
  • Notes
  • Git
Shawn Jin
2020-01-03

Git .gitignore doesn't work after update

# .gitignore doesn't work

Sometimes .gitignore files don't work even though they're correct. The reason Git ignores files is that they are not added to the repository. If you added a file that you want to ignore before, it will be tracked by Git, and any skipping matching rules will be skipped. Git does this because the file is already part of the repository.

Thus, you need to use this command below to clean the cache and re-add every files into the index.

git rm -rf --cached .   # remove cache
git add .               # add contents to the index
1
2

Then, your git should be good to go.

#Git
Updated: 2021/09/05, 15:42:35
Force Git Pull and Ignore Local Change

← Force Git Pull and Ignore Local Change

最近更新
01
Python import files from different directories
12-31
02
Classmethod in Python
09-15
03
Single/Double Star (/*) Parameters in Python
09-15
更多文章>
Theme by Vdoing | Copyright © 2019-2021 Shawn Jin | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式