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

╄→гoц情女王★ 提交于 2019-12-01 07:52:00

问题


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.

Switch to master, all changes are seen on master.

(No prompt, that need to commit changes before switching)


回答1:


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.



来源:https://stackoverflow.com/questions/28053283/egit-changes-made-in-one-branch-are-visible-on-another-branch-without-any-commi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!