简体   繁体   中英

Switching branches with IntelliJ & Git

this should be an easy one...

I'm trying IntelliJ (came from Eclipse) and I have this issue that I don't know how to handle, I have configured my project using the branchA no problems, but, as soon a try to checkout another branch branchB the IDE tells me that fails due some untracked file that will get overwrite.

The file is vcs.xml :S

If I delete it as the IDE recommends I lose the ability to switch branches.

I'm not sure what I'm missing or how do I have to configure the project so I can switch branches normally.

Any help will be appreciated, thanks.

Looks like you need to do two things

1) remove .idea/vcs.xml file from your Git repository

2) exclude it in .gitignore so you will not check this file in anymore. It is usually stored under /.idea/. This particular one can be done with

 .idea / vcs.xml

You should not check this file inside Git repository as the others suggest. Otherwise another IntelliJ user of the Git repo will overwrite his settings of vcs.

You can go on VCS > Git > Commit. There you can toggle the unversioned file and toggle the checkbox, commit and your file is in the vcs.

You need to add the untracked branch to git. From the command line it would be:

git add <file name>
git commit -m "Your message here"

In the IDE, find the file in the project tree-view, right-click, and select Git -> Add (or press Ctrl-Alt-A). Then to commit, Ctrl-K.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM