0

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
  • 1
    .gitignore is for ignoring untracked files. Commented Jan 6, 2015 at 11:27

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

5 Comments

And how can I do that in other branches without checking out and overwriting my files?
Besides, this is just a workaround. I would love to see .gitignore work.
.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 branch
How does it work when it doesn't ignore the files listed in there?
@ArkoElsenaar you can't claim that .gitignore doesn't work if you don't understand how it works.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.