Git switch branch problem

Hi folks,

i am currently evaluating IntelliJ Idea v.11.1.2, especially the Git-VCS integration.

I try to work with git branches. I can create a branch using the little drop down at the bottem right corner (clicking on "new branch"). After the branch has been created i edited a file and switched back to the master branch using the little drop down as well.

The VCS- console states a successfull checkout of the target branch and additionally merges the edited files. And thats my problem. Why are the changes merged in the other branch? Is that a bug? Ist there any configuration option to prevent immediate merging?

I dont want the files get merged when switching the branches.

Has anyone experiencd the same behaviour and found a solution to this?

Kind regards,

Comment actions Permalink

Hello sebi,

Git keeps the state of working tree (when possible) when you checkout a branch.
So if you haven't committed this file, it just stays modified after checkout, because until you commit your changes, branches are not aware about them.
And merge doesn't happen in this case as well.

Comment actions Permalink

Many thanks for your quick reply.

So that means i have to commit all changes before switching the branch back.


Comment actions Permalink

If you want these changes to be on this branch, then yes – you have to commit them.

You may want to read more about basics of working with branches and other Git structures, for example, in a very good book "Pro Git" (


Please sign in to leave a comment.