Lore
Lore

Reputation: 1928

Git switching branch policy in IntelliJ

I have created two branches for a project I'm working on with git in IntelliJ. The first branch (A) I was working on modifying a file (call it A.Java). When I switched to second branch (B) with IntelliJ checkout, after modifying A.java under branch A, the file resulted to have the same modification in B that I was doing only under A!

This policy doesn't seems normal to me, since when I'm working in A I don't want to affect other branches. Where is the problem? Is a git behavior or it is only in IntelliJ?

Upvotes: 0

Views: 298

Answers (1)

Arnaud VdP
Arnaud VdP

Reputation: 267

If you did not commit the changes on branch A before checking out branch B then that behavior is normal. If you did commit the changes on branch A then created and switched to branch B then the changes should also show up in B (eg. you did git checkout b -b)

Upvotes: 1

Related Questions