简体   繁体   中英

Using .gitignore to ignore a full directory

I have created a .gitignore file in the root directory of a project, and I would like to ignore an entire folder and anything that gets place within it.

My .gitgnore file contains only the following:

/dir/output/*

But everytime I add or modify files within the output directory the changes get tracked. Is there a way to do this?

You have to tell git to remove the cache before it starts "listening" to the new ignore. Make sure you commit your changes first and then do the following command:

git rm . -r --cached
git add .
git commit -m "what ever message"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM