I am at branch feature/branch1
, git status
list me two files that are on the .gitignore
file. When I try to checkout to develop
branch, git prevent me with this message:
error: Your local changes to the following files would be overwritten by checkout:
XXXXXXX.xcworkspace/xcuserdata/XXXX.xcuserdatad/UserInterfaceState.xcuserstate
Please, commit your changes or stash them before you can switch branches.
Aborting
Then I try to add these files although they are listed in the .gitignore
file, so I got this message:
The following paths are ignored by one of your .gitignore files:
XXXXXXX.xcworkspace
Use -f if you really want to add them.
fatal: no files added
Why git asked me to add these files? is it because they are not ignored in the develop
branch. And what best option to deal with such situation? Thanx in advance.