In Eclipse/EGit how can I see unpushed commits?

eclipse, egit, git

Solution

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 Repositories view. You can see it here:

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

To review the changes before pushing, you can look at the History view. E.g. when you have unpushed commits on the master branch, you will see origin/master in 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.

Let's look at the screenshot from your question:

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.

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 `master` and `origin/master`, but is parallel to `master`. `ORIG_HEAD` is 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.

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

Problem

Using Eclipse (EGit) how do I see/review commits that haven't been pushed to origin yet? This is what the history looks like:

Original source