egit: changes made in one branch are visible on another branch without any commit

后端 未结 1 1629
误落风尘
误落风尘 2021-01-14 22:37

I am using egit and this is what I see. Don\'t really understand how this works

From master, switch to a new branch. Make changes to existing files, modify files. <

1条回答
  •  孤街浪徒
    2021-01-14 23:13

    This is not a problem with egit, but the default behavior for how git works in general.

    If you make some changes, and do not add/commit them into git, then they are applied to any branch you checkout next.

    Only when the changes can not be automatically applied on checkout will you receive an error asking you to either stash your changes, or telling you that the file to be checked out already exists and hence checkout cannot proceed.

    So if you make changes when on another branch and want to keep those changes in that branch only, add and commit them. Alternatively, you can stash your changes as well.

    0 讨论(0)
提交回复
热议问题