How to keep .gitignored files off my gh-pages branch?
In my global
.gitignore file I chose to keep my IDE folders out of my versioning. So in my
master branch are folders like
*.iml files. If I now switch to branch
gh-pages git keeps those IDE specific files and I’m ending up with
/sample/.idea/ on that branch even though I don’t want the IDE configuration to appear on
What’s the best way to tell git to drop these files on that branch?
One Solution collect form web for “How to keep .gitignored files off my gh-pages branch?”
git added 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.