git bash - git: My uncommitted changes are carried and merged when I switch branches -
this question has answer here:
i made changes in master branch , without committing them, checked out development branch. expecting error thrown instead of that, changes in master branch merged development branch.
$ git checkout development switched branch 'development' m pom.xml branch up-to-date 'origin/development'. instead of expecting below error, stash or commit changes before checking out:
error: have local changes ....; cannot switch branches. does know why happened or how can prevent happen again?
as far know, default behavior of git. when switching branches, carry working directory you. seem recall earlier versions not case.
you might not able avoid happening, can make sure working directory (and stage) clean before switching branches. or, make commit work, or stash.
Comments
Post a Comment