eclipse egit 从上游拉取

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12546845/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:02:21  来源:igfitidea点击:

egit pull and fetch from upstream

eclipseegit

提问by Vik

i created a new branch A to do some work from master and did some work and did a local commit.

我创建了一个新分支 A 来从 master 那里做一些工作,做了一些工作,做了一个本地提交。

Then i created a branch B to do some work from master and did some work and committed it. Then i merged it to master and did push to upstream on master.

然后我创建了一个分支 B 来做一些 master 的工作,做了一些工作并提交了它。然后我将它合并到 master 并在 master 上推送到上游。

now i switched back to branch A. So to get the latest changes merged which option should i use in egit? fetch from upstream or pull ?

现在我切换回分支 A。所以要合并最新的更改,我应该在 egit 中使用哪个选项?从上游获取还是拉取?

and what is the difference?

有什么区别?

I dont want to chose randomly as i dont want to overwrite the changes...

我不想随机选择,因为我不想覆盖更改...

回答by Darryl Miles

fetch from upstreamdoes not overwrite anything in the working tree. But pullwill, but it will not completely destory work, it will create a conflict to manually merge if it can not do it automatically.

fetch from upstream不会覆盖工作树中的任何内容。但是pull会,但它不会完全破坏工作,如果不能自动完成,它会产生手动合并的冲突。

I suggest if you are unsure, ensure you working tree is clean, and everything commited. Note down the current commit-id.

我建议如果您不确定,请确保您的工作树是干净的,并且所有内容都已提交。记下当前的提交 ID。

Now you can do what you want and if it does wrong, you just clean you tree (by deleting stuff if needed). Then ask it to checkout the commit-id you noted. Now you are back where you were.

现在你可以做你想做的,如果它做错了,你只需清理你的树(如果需要,通过删除东西)。然后要求它检出您记下的提交 ID。现在你又回到了原来的地方。

commit-id's are (generally) always reachable. Meaning you can not loose where you were if you know the commit-id of where you were. i.e. clean tree and current commit-id.

commit-id(通常)总是可以访问的。这意味着如果您知道您所在位置的提交 ID,您就不会丢失您所在的位置。即干净的树和当前的提交 ID。