Git - .gitignore issue while switching branches :(

Hello all,

I have this project with two git branches. Dev and Master.
For some reason, when I checkout master, and checkout again dev, I notice that dev has lost files that where being ignored. Those files are present on master however.

I end up added some of those files back to dev, but now I need to look for another file on master and place it on dev, but I get (something like):

"Error: Can’t checkout master. Some files are untracked.

I know they are untracked on dev. They were added on .gitignore a lot before, while before those checkout commands!!

  1. Why am I having this msg ?

How can I solve this, in a way that, files ignored on DEV should also be ignored on MASTEr

I can provide all details you may require in order to help me out.

Please advice - I’m kind of stuck here… anything may help.