1942

How can I view any local commits I've made, that haven't yet been pushed to the remote repository? Occasionally, git status will print out that my branch is X commits ahead of origin/master, but not always.

Is this a bug with my install of Git, or am I missing something?

Luke Girvin
  • 12,672
  • 8
  • 57
  • 79
Josh Buhler
  • 23,638
  • 9
  • 27
  • 45
  • 21
    Starting with Git 2.5+ (Q2 2015), the actual answer would be `git log @{push}..`. See that new shortcut `@{push}` (referencing the remote tracking branch you are pushing to) in [my answer below](http://stackoverflow.com/a/30720302/6309) – VonC Jun 08 '15 at 22:44
  • 70
    @Torek - yet another simple task made difficult by Git. Every time a Git question shows up with hundreds or thousands of upvotes and millions of views, then someone should think: Wow, we really screwed up that workflow. Alas, the Git dev's have omitted the feedback step in the development life cycle, so the feedback is not incorporated. Instead, they keep making the same mistakes over and over again. For this question, `git status --all` should have appeared in 2010; or `git status -v` should actually provide the verbose output that includes the extra information. – jww Jul 10 '16 at 19:32
  • 4
    I disagree that "git status -v" should provide this information because it is intended to give status about the working tree, as it relates to the checked out branch only. However, see the answer below about "git branch -v", which I believe should be the accepted answer – JoelFan Jan 31 '17 at 19:38
  • 18
    This particular StackOverflow question has the highest number of correct answers that all work yet don't make any sense. – Pete Alvin Jan 11 '18 at 21:20
  • @josh-buhler Sorry, I down-voted accidentally... while I attempted to click the 'STAR'. Re-attempted to up-vote, but, didn't work! – RafiAlhamd Feb 14 '20 at 16:56
  • @RafiAlhamd you can undo the down-vote when you press it again. – Ray Feb 15 '20 at 15:25
  • I tried again. This is what I get: `You last voted on this question 22 hours ago. Your vote is now locked in unless this question is edited.` :-( – RafiAlhamd Feb 15 '20 at 15:30
  • @jww: I agree. I have moved back to using git after using mercurial. Compared to the ease-of-use and elegance of mercurial, git is an adulterated mess – Paul Nov 24 '20 at 14:11
  • I read all the answers hoping to find out why in all cases but my latest repo "git status" shows push/unpushed status, but why my latest repo does not. I did not find an answer: Using old repo, here is an example of an "all pushed result": On branch master Your branch is up to date with 'origin/master'. Here is what it looked like with a change: On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits). However, my newest repo does none of that...it does not show pushed/unpushed status. – K. hervey Apr 11 '21 at 17:56
  • I found my resolution: When setting up my previous repos I had used this command, adding it solved: git push --set-upstream origin master – K. hervey Apr 11 '21 at 18:08

26 Answers26

2008
git log origin/master..HEAD

You can also view the diff using the same syntax

git diff origin/master..HEAD
Epeli
  • 16,564
  • 10
  • 63
  • 76
Peter B
  • 22,874
  • 4
  • 20
  • 18
  • 4
    This did it for me - for some reason git log origin.. by itself was throwing an error. Looks like I also had a problem with the way my local branch was configured - once I made the changes I found here: https://wincent.com/blog/your-branch-is-ahead-of-origin-master-by-1-commit …the problem was resolved, and I could use git status again to see what I wanted. – Josh Buhler Jan 06 '10 at 22:57
  • 6
    Invaluable: So much so I did `git config --global alias.ahead "log origin/master..HEAD --oneline"` so that I can quickly find out where I am. Even more candy: `for i in *; do echo $i && git ahead 2>/dev/null; done` – Jamie Feb 28 '12 at 02:50
  • 1
    @Jamie, What is the eye candy version supposed to do? – Sam Hasler Jan 09 '13 at 16:39
  • 21
    `git log --stat origin/master..HEAD` for a little extra awesomeness – Cory Danielson Mar 25 '13 at 17:51
  • 1
    You should omit the branch name, as you may be on another branch: git diff HEAD – Guilherme Garnier Jun 12 '13 at 19:12
  • 152
    This is not the best solution. Origin/master may not always the upstream branch. A better solution is to use @{u} instead of "origin/master" to indicate the upstream branch. Since HEAD is implied by default, one can leave that out too. See @Ben Ling's answer. Outgoing changes: git log @{u}.. Incoming changes: git log ..@{u} – Debajit Jun 12 '13 at 22:59
  • 15
    @Nocturne I just want to point out that when this answer was posted, the `@{u}` syntax wasn't available yet, it only became available on [February 12, 2010](https://github.com/git/git/blob/v1.7.0/Documentation/RelNotes-1.7.0.txt#L104-L107). Also, `@{u}` won't work if the local branch isn't configured with an upstream. Finally, `@{u}` doesn't currently have tab completion support, `/` with tab completion remains one of the fastest ways to get this information, and it will work whether an upstream is configured or not. –  Jul 01 '14 at 00:46
  • 1
    Can this be customized to show only your own commits? – Peter Jan 08 '15 at 14:30
  • I like to do "git diff origin/MYBRANCH..HEAD | grep index" to just see how many commits I am ahead of origin/MYBRANCH – Carlos Jan 15 '15 at 16:59
  • How to do that in Tortoise Git? – endo64 Feb 03 '16 at 10:38
  • Note that `git diff @{push}..HEAD` will NOT show the local changes, but difference between current upstream position and your HEAD. So you will also see the upstream progress (reverted). To see only local changes, use 3 dots: `git diff @{push}...HEAD`. See [git diff docs](https://git-scm.com/docs/git-diff) for details – max630 Mar 27 '16 at 21:15
  • check out @VonC's answer, it's got the point. IMO it's more preferable way to check against repo/branch that you push to, not pull from. – vigilancer Apr 07 '16 at 00:32
  • 1
    This is the weirdest syntax I've ever seen. – Pete Alvin Jan 11 '18 at 21:16
  • by example `git log @{u}.. -p` One of the most useful options is **-p**, which shows the differences introduced in each confirmation – mQuiroz Sep 20 '18 at 18:53
  • Note that "main" may have to be used instead of "master" now. – Kotlopou Jan 13 '21 at 12:33
  • Worked for me using git version 2.30.1.windows.1 – combatc2 Mar 01 '21 at 01:57
755

If you want to see all commits on all branches that aren't pushed yet, you might be looking for something like this:

git log --branches --not --remotes

And if you only want to see the most recent commit on each branch, and the branch names, this:

git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
alex
  • 438,662
  • 188
  • 837
  • 957
cxreg
  • 9,788
  • 1
  • 16
  • 10
  • 9
    This is awesome. In a related scenario I had two local branches with two upstream branches, and one local hand been merged into the other. I wanted to know which commits were safe to rebase, but the normal `git log master..HEAD` wouldn't work since there were multiple upstreams. This post led me to `git log MyBranch --not --remotes` to show all the commits that have not been pushed to any upstream in a single branch. – pavon Jul 12 '14 at 02:10
  • This was so useful I aliased it in my zsh config. Thanks. – Scotty C. Jul 29 '15 at 21:34
  • I understand that your second command is also listing the commits that aren't pushed yet, only it shows just one per branch. – Stephane Mar 30 '16 at 06:19
  • `--decorate` shows the branches as well. `--graph` makes it even more obvious. – Ray Dec 20 '16 at 11:19
  • Note that these commands list only commits that haven't been pushed in **any** branch. Example: say you have branch develop with branch feat-NewThing. You make changes locally to feat-NewThing. (Log has changes.) You then push feat-newThing to it's remote branch. (Log is empty). You merge local feat-newThing to develop locally. Assuming a fast-forward, the log still has no changes. – Patrick W Jan 17 '17 at 00:02
  • This is the actual solution. The only one that works generally without the need to specify a branch or the need to have an upstream defined. – thisismydesign Sep 05 '17 at 10:02
  • This works also even if no upstream has been configured for a branch. – Marinos An Oct 16 '17 at 11:15
  • @pavon Couldn't this also be `git log HEAD --not --remotes` for the current branch? – Marinos An Oct 16 '17 at 11:19
  • How to use not pushed commits, old commits which I can see git log --branches --not --remotes. If I check out the branch, I got pushed version from remote, but I would like to use my local commited not pushed version. – Sami May 27 '20 at 19:36
  • does not work here... while "git log origin/xyz..xyz" shows a unpushed local commit, "git log --branches --not --remotes" does NOT! – Alexander Schäl Oct 27 '20 at 08:36
340

You can show all commits that you have locally but not upstream with

git log @{u}..

@{u} or @{upstream} means the upstream branch of the current branch (see git rev-parse --help or git help revisions for details).

Ben Lings
  • 27,150
  • 13
  • 69
  • 79
  • 18
    On Windows, I needed to enclose the final argument in quotes, like: git log "@{u}.." – Jon Schneider Nov 15 '16 at 13:48
  • 2
    `git log @{u}.. -p` One of the most useful options is **-p**, which shows the differences introduced in each confirmation. – mQuiroz Sep 20 '18 at 18:50
  • 2
    Possibly better git log @{push}.. , see [another answer](https://stackoverflow.com/a/30720302/21499). – Hans-Peter Störr Nov 26 '19 at 12:13
  • I found this one is the best answer. I also found that there is no way on Earth I'll remember it without a cheat sheet. Why didn't the git devs chose something obvious, and in line with git status, since we want to know the *status* of a situation. `git status -v` would have made so much more sense. – Fabien Haddadi May 12 '21 at 15:49
206

This worked for me:

git cherry -v 

As indicated at Git: See all unpushed commits or commits that are not in another branch.

Christian Vielma
  • 12,606
  • 12
  • 52
  • 59
  • 25
    I think this should be the main answer as this one gives the more succinct list of commits instead of, hard to read, verbose difference in all the files !! – ViFI Aug 12 '16 at 00:46
  • 1
    [git-cherry](https://git-scm.com/docs/git-cherry) - "Find commits yet to be applied to upstream", seems to provide what the OP was asking for, but with only commit subject rather than the entire commit message. – Eido95 Feb 08 '17 at 20:58
  • 4
    It's worth noting that this will only tell you if there are unpushed commits on the branch you have currently checked out. It will not tell you if you have a local branch (not currently checked out) with unpushed commits. – Dave Yarwood Dec 02 '17 at 13:47
71

You can do this with git log:

git log origin/master..

This assumes that origin is the name of your upstream remote and master is the name of your upstream branch. Leaving off any revision name after .. implies HEAD, which lists the new commits that haven't been pushed.

Greg Hewgill
  • 828,234
  • 170
  • 1,097
  • 1,237
  • 1
    Whenever I see an answer with `git log` and "2-dots-not-3", it always remind me of http://stackoverflow.com/questions/53569/how-to-get-the-changes-on-a-branch-in-git/53573#53573 ;) – VonC Jan 06 '10 at 22:56
  • 1
    Just to add it to the answer - if there is no upstream setup this command result in saying no upstream was setup. Run `git branch --set-upstream master origin/` to setup upstream if you are inclined to use this command to see commits that are staged. – asyncwait Aug 07 '13 at 13:27
  • This will compare with default branch in origin, not current remote branch. – greuze Jun 18 '14 at 07:20
  • fatal: ambiguous argument 'origin..': unknown revision or path not in the working tree. – insign Nov 22 '20 at 23:43
  • Nope, it shows all latest commits that differ, but does not answer the original Q. – Fabien Haddadi May 12 '21 at 15:46
52

All the other answers talk about "upstream" (the branch you pull from).
But a local branch can push to a different branch than the one it pulls from.

master might not push to the remote tracking branch "origin/master".
The upstream branch for master might be origin/master, but it could push to the remote tracking branch origin/xxx or even anotherUpstreamRepo/yyy.
Those are set by branch.*.pushremote for the current branch along with the global remote.pushDefault value.

It is that remote-tracking branch which counts when seeking unpushed commits: the one that tracks the branch at the remote where the local branch would be pushed to.
The branch at the remote can be, again, origin/xxx or even anotherUpstreamRepo/yyy.

Git 2.5+ (Q2 2015) introduces a new shortcut for that: <branch>@{push}

See commit 29bc885, commit 3dbe9db, commit adfe5d0, commit 48c5847, commit a1ad0eb, commit e291c75, commit 979cb24, commit 1ca41a1, commit 3a429d0, commit a9f9f8c, commit 8770e6f, commit da66b27, commit f052154, commit 9e3751d, commit ee2499f [all from 21 May 2015], and commit e41bf35 [01 May 2015] by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit c4a8354, 05 Jun 2015)

Commit adfe5d0 explains:

sha1_name: implement @{push} shorthand

In a triangular workflow, each branch may have two distinct points of interest: the @{upstream} that you normally pull from, and the destination that you normally push to. There isn't a shorthand for the latter, but it's useful to have.

For instance, you may want to know which commits you haven't pushed yet:

git log @{push}..

Or as a more complicated example, imagine that you normally pull changes from origin/master (which you set as your @{upstream}), and push changes to your own personal fork (e.g., as myfork/topic).
You may push to your fork from multiple machines, requiring you to integrate the changes from the push destination, rather than upstream.
With this patch, you can just do:

git rebase @{push}

rather than typing out the full name.

Commit 29bc885 adds:

for-each-ref: accept "%(push)" format

Just as we have "%(upstream)" to report the "@{upstream}" for each ref, this patch adds "%(push)" to match "@{push}".
It supports the same tracking format modifiers as upstream (because you may want to know, for example, which branches have commits to push).

If you want to see how many commit your local branches are ahead/behind compared to the branch you are pushing to:

git for-each-ref --format="%(refname:short) %(push:track)" refs/heads
Johan Kaving
  • 4,742
  • 1
  • 25
  • 20
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
41

Handy git alias for looking for unpushed commits in current branch:

alias unpushed = !GIT_CURRENT_BRANCH=$(git name-rev --name-only HEAD) && git log origin/$GIT_CURRENT_BRANCH..$GIT_CURRENT_BRANCH --oneline

What this basically does:

git log origin/branch..branch

but also determines current branch name.

Dag Høidahl
  • 6,759
  • 7
  • 46
  • 62
takeshin
  • 44,484
  • 28
  • 112
  • 160
  • 8
    This is awesome! For those unfamiliar with aliases just add them to your ~/.gitconfig file under the [alias] section. – Gary Haran Apr 15 '13 at 15:07
  • 1
    Copy/paste in bash doesn't work, but the script is quite useful and understandable – greuze Sep 30 '14 at 08:39
  • This is not a bash alias, as @GaryHaran points out. There's a git command for adding aliases as well: `git alias ` In this case, the command should be surrounded by single quotes, to escape special characters from the shell. – Dag Høidahl Jan 27 '16 at 12:45
  • 4
    That would be: `git config --global alias.unpushed '!GIT_CURRENT_BRANCH=$(git name-rev --name-only HEAD) && git log origin/$GIT_CURRENT_BRANCH..$GIT_CURRENT_BRANCH --oneline'` – Ricky Levi Jul 19 '17 at 10:21
  • That seems basically the same as git log @{u}.. , though - see [another answer](https://stackoverflow.com/a/8182309/21499). – Hans-Peter Störr Nov 26 '19 at 12:09
38

I had a commit done previously, not pushed to any branch, nor remote nor local. Just the commit. Nothing from other answers worked for me, but with:

git reflog

There I found my commit.

Sunil Garg
  • 10,122
  • 12
  • 92
  • 133
Olaia
  • 1,887
  • 21
  • 25
  • 1
    As stated in this link https://git-scm.com/docs/git-reflog, Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository. In my case, i cloned a repo, created a new branch, deleted the branch, created a new one, created a commit and changed the commit. All these steps where recored as HEAD@{0}: commit (amend) : .. HEAD@{1}: commit: ... HEAD@{2}: checkedout: moving from...to ... HEAD@{3}: checkedout: moving from...to ... HEAD@{4}: clone: from #sorry for the format SO does not allow multilines in comments apparently – velocity Apr 22 '20 at 22:17
  • 1
    this includes the origin commits as well, the best solution would be use the command provided by @PlagueHammer (https://stackoverflow.com/a/2016954/624048) – Lincoln May 25 '20 at 12:13
37

You could try....

gitk

I know it is not a pure command line option but if you have it installed and are on a GUI system it's a great way to see exactly what you are looking for plus a whole lot more.

(I'm actually kind of surprised no one mentioned it so far.)

Justin Ohms
  • 2,689
  • 25
  • 37
30

git branch -v will show, for each local branch, whether it's "ahead" or not.

Aurelien
  • 1,492
  • 1
  • 17
  • 28
  • 2
    Yes, in case there is an unpushed commit on branch `devel`, the corresponding line will be `* devel 8a12fc0 [ahead 1] commit msg` (`*` will be only on the line corresponding to the checked out branch). `ahead 1` means "ahead by one commit", i.e. there is one unpushed commit. – Aurelien Jun 20 '15 at 17:42
  • 2
    Isn't it `git branch -vv`? Cf. docs: “If given twice, print the name of the upstream branch, as well (see also git remote show ).” – Dirty Henry Oct 03 '18 at 08:34
  • This is not about printing the name of the upstream branch, but just about printing `behind` and/or `ahead` for each local branch, which is enough to solve OP's problem (detecting unpushed commits). `git branch -v` is enough for that, just tested again with Git 2.16.2 :) – Aurelien Oct 04 '18 at 09:16
  • The -vv is useful because with it shows a difference between the branches which are up-to-date with the remote and those which haven't been pushed at all. (With just one -v, they show up identically in the display.) – R.M. Jan 24 '20 at 15:07
21

I use the following alias to get just the list of files (and the status) that have been committed but haven't been pushed (for the current branch)

git config --global alias.unpushed \
"diff origin/$(git name-rev --name-only HEAD)..HEAD --name-status"

then just do:

git unpushed
CCC
  • 2,427
  • 5
  • 35
  • 54
  • looks interesting, but $(git name-rev --name-only HEAD) is "undefined" in my case – vak Nov 14 '13 at 15:43
13

I believe the most typical way of doing this is to run something like:

git cherry --abbrev=7 -v @{upstream}

However, I personally prefer running:

git log --graph --decorate --pretty=oneline --abbrev-commit --all @{upstream}^..

which shows the commits from all branches which are not merged upstream, plus the last commit in upstream (which shows up as a root node for all the other commits). I use it so often that I have created alias noup for it.

git config --global alias.noup \
'log --graph --decorate --pretty=oneline --abbrev-commit --all @{upstream}^..'
Giorgos Kylafas
  • 2,014
  • 23
  • 24
12
git cherry -v

This will list out your local comment history (not yet pushed) with corresponding message

adswebwork
  • 4,741
  • 3
  • 17
  • 9
11

I suggest you go see the script https://github.com/badele/gitcheck, i have coded this script for check in one pass all your git repositories, and it show who has not commited and who has not pushed/pulled.

Here a sample result enter image description here

Bruno Adelé
  • 949
  • 10
  • 16
  • 1
    Could you please explain how to get this plugin to work on Windows machine? I am trying to run pip, but the command is missing in command line. I got Python installed, but I am not sure if it is enough. – Konrad Szałwiński Apr 24 '14 at 08:17
  • @KonradSzałwiński I haven't windows machine, but in this topic ( http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows ), the user seem answer at your question :). But i haven't tested in windows and i'm not sure it work it. – Bruno Adelé May 23 '14 at 16:05
  • @KonradSzałwiński the ChristianTremblay github contributor has added a windows support. Now the gitcheck work on windows. You can download it on https://github.com/badele/gitcheck – Bruno Adelé Nov 27 '14 at 19:17
  • Now, you can also use gitcheck directly from an docker container (with your files in your host) For more information see the gitcheck github project – Bruno Adelé May 06 '15 at 19:27
  • Thanks for posting this, it seems really useful. I tried installing but after installation I can't find the location of the script to run it. $ pip install git+git://github.com/badele/gitcheck.git Collecting git+git://github.com/badele/gitcheck.git Cloning git://github.com/badele/gitcheck.git to c:\users\u6041501\appdata\local\temp\pip-bxt472z_-build Installing collected packages: gitcheck Running setup.py install for gitcheck: started Running setup.py install for gitcheck: finished with status 'done' Successfully installed gitcheck-0.3.22 – Lauren Fitch Mar 19 '18 at 16:20
9

It is not a bug. What you probably seeing is git status after a failed auto-merge where the changes from the remote are fetched but not yet merged.

To see the commits between local repo and remote do this:

git fetch

This is 100% safe and will not mock up your working copy. If there were changes git status wil show X commits ahead of origin/master.

You can now show log of commits that are in the remote but not in the local:

git log HEAD..origin
Igor Zevaka
  • 69,206
  • 26
  • 104
  • 125
8

This worked better for me:

git log --oneline @{upstream}..

or:

git log --oneline origin/(remotebranch)..
VaTo
  • 2,560
  • 4
  • 28
  • 61
  • 4
    For anyone else wondering, `@{upstream}` is literal (`upstream` is a magic word), while `remotebranch` is just the name of your branch. – Steve Bennett Dec 01 '15 at 00:23
7

There is tool named unpushed that scans all Git, Mercurial and Subversion repos in specified working directory and shows list of ucommited files and unpushed commits. Installation is simple under Linux:

$ easy_install --user unpushed

or

$ sudo easy_install unpushed

to install system-wide.

Usage is simple too:

$ unpushed ~/workspace
* /home/nailgun/workspace/unpushed uncommitted (Git)
* /home/nailgun/workspace/unpushed:master unpushed (Git)
* /home/nailgun/workspace/python:new-syntax unpushed (Git)

See unpushed --help or official description for more information. It also has a cronjob script unpushed-notify for on-screen notification of uncommited and unpushed changes.

nailgun
  • 111
  • 1
  • 3
6

To list all unpushed commit in all branches easily you can use this command:

 git log --branches  @{u}..
Mohsen Kashi
  • 4,102
  • 3
  • 38
  • 61
4

If the number of commits that have not been pushed out is a single-digit number, which it often is, the easiest way is:

$ git checkout

git responds by telling you that you are "ahead N commits" relative your origin. So now just keep that number in mind when viewing logs. If you're "ahead by 3 commits", the top 3 commits in the history are still private.

Kaz
  • 48,579
  • 8
  • 85
  • 132
4

Similar: To view unmerged branches:

git branch --all --no-merged

Those can be suspect but I recommend the answer by cxreg

Christophe Roussy
  • 13,732
  • 2
  • 75
  • 75
3

one way of doing things is to list commits that are available on one branch but not another.

git log ^origin/master master
Alexander Oh
  • 20,413
  • 12
  • 65
  • 70
1

As said above:

git diff origin/master..HEAD

But if you are using git gui

After opening gui interface, Select "Repository"->Under that "Visualize History"

Note: Some people like to use CMD Prompt/Terminal while some like to use Git GUI (for simplicity)

vrnair24
  • 53
  • 1
  • 8
0

If you have git submodules...

Whether you do git cherry -v or git logs @{u}.. -p, don't forget to include your submodules via git submodule foreach --recursive 'git logs @{u}..'.

I am using the following bash script to check all of that:

    unpushedCommitsCmd="git log @{u}.."; # Source: https://stackoverflow.com/a/8182309

    # check if there are unpushed changes
    if [ -n "$($getGitUnpushedCommits)" ]; then # Check Source: https://stackoverflow.com/a/12137501
        echo "You have unpushed changes.  Push them first!"
        $getGitUnpushedCommits;
        exit 2
    fi

    unpushedInSubmodules="git submodule foreach --recursive --quiet ${unpushedCommitsCmd}"; # Source: https://stackoverflow.com/a/24548122
    # check if there are unpushed changes in submodules
    if [ -n "$($unpushedInSubmodules)" ]; then
        echo "You have unpushed changes in submodules.  Push them first!"
        git submodule foreach --recursive ${unpushedCommitsCmd} # not "--quiet" this time, to display details
        exit 2
    fi
Aidin
  • 7,505
  • 2
  • 35
  • 33
-2

Here's my portable solution (shell script which works on Windows too without additional install) which shows the differences from origin for all branches: git-fetch-log

An example output:

==== branch [behind 1]

> commit 652b883 (origin/branch)
| Author: BimbaLaszlo <bimbalaszlo@gmail.com>
| Date:   2016-03-10 09:11:11 +0100
|
|     Commit on remote
|
o commit 2304667 (branch)
  Author: BimbaLaszlo <bimbalaszlo@gmail.com>
  Date:   2015-08-28 13:21:13 +0200

      Commit on local

==== master [ahead 1]

< commit 280ccf8 (master)
| Author: BimbaLaszlo <bimbalaszlo@gmail.com>
| Date:   2016-03-25 21:42:55 +0100
|
|     Commit on local
|
o commit 2369465 (origin/master, origin/HEAD)
  Author: BimbaLaszlo <bimbalaszlo@gmail.com>
  Date:   2016-03-10 09:02:52 +0100

      Commit on remote

==== test [ahead 1, behind 1]

< commit 83a3161 (test)
| Author: BimbaLaszlo <bimbalaszlo@gmail.com>
| Date:   2016-03-25 22:50:00 +0100
|
|     Diverged from remote
|
| > commit 4aafec7 (origin/test)
|/  Author: BimbaLaszlo <bimbalaszlo@gmail.com>
|   Date:   2016-03-14 10:34:28 +0100
|
|       Pushed remote
|
o commit 0fccef3
  Author: BimbaLaszlo <bimbalaszlo@gmail.com>
  Date:   2015-09-03 10:33:39 +0200

      Last common commit

Parameters passed for log, e.g. --oneline or --patch can be used.

bimlas
  • 1,757
  • 1
  • 15
  • 25
-3
git show

will show all the diffs in your local commits.

git show --name-only

will show the local commit id and the name of commit.

the Tin Man
  • 150,910
  • 39
  • 198
  • 279
user2387567
  • 135
  • 2
  • 3
  • 3
    `git show` only shows the most recent commit, whether it's been pushed to the remote or not, it won't show you all of your unpushed commits. –  Jul 01 '14 at 00:28
-5
git diff origin

Assuming your branch is set up to track the origin, then that should show you the differences.

git log origin

Will give you a summary of the commits.

mopoke
  • 10,090
  • 1
  • 29
  • 31
  • 3
    `git log origin` will show you commits that have ***already been pushed***, but it will not show commits that ***haven't been pushed***, which is more along the lines of what the original poster was asking for. –  Jul 01 '14 at 00:57