Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

git - .gitignore Doesn't Seem To Work

My .gitignore:

.DS_Store
/.idea
/.idea_modules
/out
/project
/target
/*.iml
*/resolution-cache/*
*/streams/*
*/target/*

But nonetheless, the folders .idea, .idea_modules and target have appeared in a repo and are still there.

Your ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Ignoring is only useful for files that are not currently being tracked by the repo. If those directories were added to the repo before being put in .gitignore, they will continue to be tracked.

Use git rm --cached <file> to stop tracking a file.

Of course you should make a commit with the removed files and push to the repo to see the changes in the remote repository


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...