git 在 Eclipse/EGit 中,如何查看未推送的提交?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21460676/
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 09:39:40  来源:igfitidea点击:

In Eclipse/EGit how can I see unpushed commits?

eclipsegitegit

提问by Grzegorz Oledzki

Using Eclipse (EGit) how do I see/review commits that haven't been pushed to origin yet?

使用 Eclipse (EGit) 如何查看/尚未推送到源的提交?

This is what the history looks like:

这就是历史的样子:

EGit History view

EGit 历史视图

回答by robinst

You can see whether you have unpushed commits by the arrow and number in the decoration of the project in the explorer view or the Git Repositoriesview. You can see it here:

您可以在资源管理器视图或Git 存储库视图中通过项目装饰中的箭头和数字查看是否有未推送的提交。你可以在这里看到它:

enter image description here

在此处输入图片说明

In the picture above, the http-requestrepository has 2 unpushed commits.

在上图中,http-request存储库有 2 个未推送的提交。

To review the changes before pushing, you can look at the Historyview. E.g. when you have unpushed commits on the masterbranch, you will see origin/masterin the history pointing to the latest commit that is known on the remote repository. On top of that, you will see your local commits and the label for master.

要在推送之前查看更改,您可以查看历史视图。例如,当您在master分支上有未推送的提交时,您将在历史记录中看到origin/master指向远程存储库中已知的最新提交。最重要的是,您将看到您的本地提交和master的标签。

Let's look at the screenshot from your question:

让我们看一下您的问题的屏幕截图:

EGit History view

EGit 历史视图

This is how to read the history: Start at the commit labeled master, which is the topmost one. Then follow the orange line downwards until you arrive at the next commit, which is the third one labeled origin/master. So you locally have one more commit, which is shown in the project decorations as an upwards-pointing arrow with the number 1 besides it.

这是读取历史记录的方法:从标记为 的提交开始master,这是最上面的提交。然后沿着橙色线向下,直到到达下一个提交,即标记为 的第三个提交origin/master。所以你在本地还有一个提交,它在项目装饰中显示为一个向上的箭头,旁边有数字 1。

You may be confused by the second commit in the screenshot, labeled ORIG_HEAD. When you look at the lines you will see that it is not included between masterand origin/master, but is parallel to master. ORIG_HEADis a backup copy of your HEAD before you did a "dangerous" operation such as reset. You can use it to undo a reset for example.

您可能会对屏幕截图中标记为 的第二次提交感到困惑ORIG_HEAD。当您查看这些线时,您会发现它不包含在master和之间origin/master,而是平行于masterORIG_HEAD是在您执行重置等“危险”操作之前的 HEAD 备份副本。例如,您可以使用它来撤消重置。

If you don't want to see ORIG_HEADin the history, open the view menu (that little triangle) and deselect Show> Additional Refs, see the manual.

如果您不想ORIG_HEAD在历史记录中看到,请打开视图菜单(那个小三角形)并取消选择Show> Additional Refs请参阅手册

回答by Daniel Figueroa

Go to Window->Show View->Other->GIT->Git Reflog

Window-> Show View-> Other-> GIT->Git Reflog

There you'll see the commits that both have been pushed and those that aren't pushed, but wont differentiate between them.

在那里您会看到已推送的提交和未推送的提交,但不会区分它们。

Better is to use the Egit equivalent of Gitk:

更好的是使用 Gitk 的 Egit 等价物:

Right click on the Project choose Team->Show in history. For each commit you'll se which branches that commit is available on. If it only says <tree-name>and not origin/<tree-name>it means that it isn't pushed.

右键单击项目选择Team-> Show in history。对于每个提交,您将看到该提交在哪些分支上可用。如果它只说<tree-name>而不是origin/<tree-name>它意味着它没有被推动。