egit:在一个分支中所做的更改在另一个分支上可见而没有任何提交 [英] egit: changes made in one branch are visible on another branch without any commit

查看:149
本文介绍了egit:在一个分支中所做的更改在另一个分支上可见而没有任何提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用egit,这就是我所看到的。真的不明白它是如何工作的



从master切换到新分支。
更改现有文件,修改文件。

切换到master,所有更改都在master上显示。



(无提示,需要在切换之前提交更改)

解决方案

这不是egit的问题,而是git如何工作的默认行为。



如果您进行了一些更改,而不是将其添加/提交到git,那么它们就会应用到你接下来签出的任何分支。



只有在结账时无法自动应用更改时,才会收到一个错误,要求您要么隐藏更改或告诉您要检出的文件已存在,因此checkout无法继续。



因此,如果您在其他分支上进行更改并希望保留这些更改只在该分支中添加并提交它们。或者,您也可以隐藏您的更改。


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)

解决方案

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.

这篇关于egit:在一个分支中所做的更改在另一个分支上可见而没有任何提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆