Reputation: 7298
In my global .gitignore
file I chose to keep my IDE folders out of my versioning. So in my master
branch are folders like .idea/
or *.iml
files. If I now switch to branch gh-pages
git keeps those IDE specific files and I'm ending up with /index.html
, /src/.idea/
, /sample/.idea/
on that branch even though I don't want the IDE configuration to appear on gh-pages
.
What's the best way to tell git to drop these files on that branch?
Upvotes: 1
Views: 419
Reputation: 18530
You probably git add
ed those files before setting up the ignore rules. Ignore rules apply to untracked files only; they have no effect on stuff that's already staged/committed.
Given that situation, you can simply make a new commit to get rid of them again:
git rm --cached <bad files>
git commit
Or you can use history rewriting to get the unwanted files out of the history altogether. Don't do this if other people are already working on the current version of your repo, though.
Upvotes: 1