I am using Git now for a short time, and I have experienced a few annoying things. I have a few branches now, however, when I switch branches, my config files are being overwritten (they are in my .gitignore). How is this possible, and what things can I do to find out what causes this issue?
1 Answer
make sure, that config-files are not present in git repositories. .gitignore merely prevents changes from being committed, but doesn't ignore files which are already committed.
So, git rm yourconfig.file in every branch, put local copies in directories and it will work just fine
5 Comments
Arko Elsenaar
And how can I do that in other branches without checking out and overwriting my files?
Arko Elsenaar
Besides, this is just a workaround. I would love to see
.gitignore work.JimiDini
.gitignore DOES work. it just doesn't do what you expect it to do. regarding first comment: copy your configs to a separate place, do git rm and manually restore the files after you did it in every branchArko Elsenaar
How does it work when it doesn't ignore the files listed in there?
Alex Wolf
@ArkoElsenaar you can't claim that
.gitignore doesn't work if you don't understand how it works.
.gitignoreis for ignoring untracked files.