I have a module in drupal.org git. My local copy has 2 commits pending, but I was expecting to see only one. So, I'm curious what's in the other commit that I either forgot to push or who knows what happened.

So, here's what git tells me...

[dave@starbuck fb-3]$ git status
# On branch 6.x-3.x
# Your branch is ahead of 'origin/6.x-3.x' by 2 commits.
#

What I want to know is, what is in each of those commits, before I push them.

What git commands do I need to use?

Comments

Dave Cohen’s picture

Update....

I figured out that git diff origin/6.x-3.x is what might be the answer. However, when I run this, I see only one change to one file (the one commit that I am aware of). What the heck is the second commit that git is telling me about?

Here's the one change:

[dave@starbuck fb-3]$ git diff origin/6.x-3.x
diff --git a/README.txt b/README.txt
index 5a097ce..312ea79 100644
--- a/README.txt
+++ b/README.txt
@@ -20,7 +20,8 @@ To upgrade:

To install:

-- Make sure you have an up-to-date PHP client from facebook.
+- Make sure you have a PHP client from facebook (version < 3.0.0).
+  The 3.0.0 or higher versions are not supported by this version of Drupal for Facebook.
   Download from http://github.com/facebook/php-sdk.
   Extract the files, and place them in sites/all/libraries/facebook-php-sdk.

dman’s picture

It's possible to have made two different commits to one line, that, when run one after the other, result in just one real change.

Even looking at your message, I see something new : the [+-] flag there. I don't recognise it, but it may be that:

You modified that line of text, and committed.
You changed it again and committed.

if you do a diff, you see the difference between what was in the origin repo, and what your version is now - effectively one line changed.
What happened, because git tracks local commits as events, and will forward each event up into the commit log - is there were two commits that happened.

You could even make a change, commit, revert it, commit, and a diff would show "2 commits, 0 changes"

dman’s picture

git log

Shows you the commit histiry.
You can git diff -r d930b7b44339b003931e1eae5adaad6dccd754ab (copy the hash from the log) to compare your current state against any point in the log, including this phantom commit you are looking for.

Dave Cohen’s picture

git show shows exactly the one commit I expect...

[dave@starbuck fb-3]$ git show
commit 17c1b082e2876cef91cbf3aeaeecd8dc4ff1b548
Merge: 03d922d dc9d936
Author: Dave Cohen <git@dave-cohen.com>
Date:   Wed Jun 1 14:25:53 2011 -0700

    Merge branch '6.x-3.x' of git.drupal.org:project/fb into 6.x-3.x

Still, git status shows 2 commits.

Dave Cohen’s picture

(I was mistaken in my earlier post, I misread what git show was outputting. It was only showing one commit, but not the one I expected to see.)

It turns out, git show only shows one commit. There is no option to show all commits (so few options are documented in git help), but to show say the last 3 commits, use git show -n3.

Using that, I was able to find out about my mystery commit...

commit 17c1b082e2876cef91cbf3aeaeecd8dc4ff1b548
Merge: 03d922d dc9d936
Author: Dave Cohen <git@dave-cohen.com>
Date:   Wed Jun 1 14:25:53 2011 -0700

    Merge branch '6.x-3.x' of git.drupal.org:project/fb into 6.x-3.x

This may mean something to someone, but certainly not to me. Once again, git has outperformed my feeble intelligence. You win, git.

I try not to hate git, but it is the RCS of distributed version control.

diqidoq’s picture

Now I don't feel alone no more...