Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See exact divergence/commits between local and remote Git repo

Setup: 3 git repos - on github, local and on staging server.

I develop locally, push it to github and staging server pulls.

I don't work nor commit changes on staging server, but I must have done so long time ago. Because now I get the following message when I do git status (on staging server):

On branch SOME_BRANCH
Your branch and 'origin/SOME_BRANCH' have diverged,
and have 4 and 32 different commit(s) each, respectively.

My question is: how do I see those exact 4 commits that are not at origin?

like image 696
Uzbekjon Avatar asked May 02 '12 19:05

Uzbekjon


2 Answers

git rev-list origin..HEAD

This lists the commits in your branch (HEAD) that are not in origin.

like image 122
CharlesB Avatar answered Oct 22 '22 22:10

CharlesB


Generically, if your remote is called foo and your branch is bar:

git rev-list foo/bar..HEAD

@charlesb is the answer for being in the master branch with remote called origin.

like image 34
nessa.gp Avatar answered Oct 22 '22 20:10

nessa.gp