Let's say I'm working on branch1
and create a branch2
from branch1
.
Up until recently, when I did some changes to branch2
and didn't commit them without changing to branch1
, the IntelliJ console warned me that I first need to commit my changes or I wouldn't be able to change.
But now, when using git checkout branch1
while I'm on branch2
without commiting my changes on branch2
, for some reason all my changes get automatically commited AND transfered to branch1
.
For example:
I'm on branch2
and modify some files. I forget to commit the changes and try to switch to branch1
. This is what happens...
git checkout branch1
Switched to branch 'branch1'
M src/main/java/Test.java
Your branch is up to date with 'origin/branch1'.
...and all the changes I made in branch2
are transfered to branch1
!
I don't want this behaviour. I don't want to transfer all the changes I made in branch2
to branch1
when I'm using git checkout. It should warn me that I forgot to commit instead of adopting the changes.
EDIT:
Previously, I'd get an error message like the following one:
git checkout branch1
error: Your local changes to the following files would be overwritten by checkout:
Test.java
Please, commit your changes or stash them before you can switch branches.
Aborting
And now the message is ignored and the changes are just automatically merged/transfered from branch2
to branch1
like in the example above, without showing me an error.