git-How to make the configuration take effect after modifying .gitignore

When using git we sometimes need to ignore some files or folders. We generally create the .gitignore file in the root directory of the repository

 

Before committing, modify the .gitignore file to add files that need to be ignored. Then do add commit push etc.

 

But sometimes in the used name, the .gitignore file needs to be modified again. This time we need to clear the cache for .gitignore to take effect.

specific methods:

 

[plain]  view plain copy  
 
  1. git rm -r --cached . #Clear cache  
  2. git add . #retrace file  
  3. git commit -m "update .gitignore" #Commit and comment  
  4. git push origin master #Optional, if you need to synchronize to the remote  


This will enable the modified .gitignore to take effect.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174761&siteId=291194637