gitintellij-ideacommit

"Untracked Files Prevent Checkout" except its vcs.xml


I'm trying to merge a branch with the master, so I checked out the master but now it won't let me do the merge:

Untracked Files Prevent Checkout Move or commit them before checkout .idea/vcs.xml

I can't move or delete the file, because it will disengage the VCS from this project I can't commit it because it's not an option when I try to commit I can't switch to the branch to see what I can do from that end, because I get the same error message.

How can I fix this and how can I prevent it from happening again? Do I need a .gitignore file that is set up to exclude everything from the .idea folder?


Solution

  • The branch you're trying to merge has this file checked into it, but the master branch has untracked (and possibly in .gitignore). When you're trying to merge the other branch, Git prevents you from overwriting those files because you might care about them (after all, one side has them tracked).

    You have some options: