[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: git: how to figure out with a script what the last commit on remote repo is without fetching it



2014/09/21 12:15 "lee" <lee@yun.yagibdah.de>:
>
> Joel Rees <joel.rees@gmail.com> writes:
>
> > On Sun, Sep 21, 2014 at 3:43 AM, lee <lee@yun.yagibdah.de> wrote:
> >> Joel Rees <joel.rees@gmail.com> writes:
> >>
> >>> Well, your experience with git and mine are quite different.
> >>>
> >>> On Sat, Sep 20, 2014 at 11:15 PM, lee <lee@yun.yagibdah.de> wrote:
> >>>> Joel Rees <joel.rees@gmail.com> writes:
> >>>> [...]
> >>>
> >>> Let's clear the conversation, it's too cluttered for me to make sense
> >>> of it any more.
> >>>
> >>> cd to your local copy of the repository you want to do some work in.
> >>> Try these two commands:
> >>>
> >>>     git log
> >>
> >>
> >> [~/inst/emacs/emacs-git/emacs] git log
> >>
> >> ,----
> >> | commit f0aeb3ae50be0f96cefa391c8483d8be9f81d9f9
> >> | Merge: 4dbf5c2 9ce4cf2
> >> | Author: lee <lee@yun.yagibdah.de>
> >> | Date:   Sun Aug 31 18:47:54 2014 +0200
> >> |
> >> |     Merge branch 'master' of git://git.savannah.gnu.org/emacs
> >> |
> >> | [...]
> >> `----
> >>
> >>
> >>>     git branch --list -ar
> >>
> >> ,----
> >> | [~/inst/emacs/emacs-git/emacs] git branch --list -ar
> >> |   origin/HEAD -> origin/master
> >> |   [...]
> >> | [~/inst/emacs/emacs-git/emacs]
> >> `----
> >>
> >>> What do they tell you?
> >>
> >> That it's been a while since I did a 'git pull'?
> >
> > Well, that, too.
> >
> > What do
> >
> >     git status
>
>
> ,----
> | [~/inst/emacs/emacs-git/emacs] git status
> | On branch master
> | Your branch and 'origin/master' have diverged,
> | and have 9 and 78 different commits each, respectively.
> |   (use "git pull" to merge the remote branch into yours)

This message is very important.

> | Untracked files:
> |   (use "git add <file>..." to include in what will be committed)
> | [...]
> `----
>
> >
> > and
> >
> >     git diff
> >
> > give you?
>
>
> ,----
> | [~/inst/emacs/emacs-git/emacs] git diff
> | [~/inst/emacs/emacs-git/emacs]
> `----
>
>
> If there were diffs shown, only the local diffs would show up.
> [...]

Because your branch and origin/master have diverged. (Talking about HEAD was misleading. I still get cvs/svn and git confused in this way. Sorry about that)

Can't explain now because I'm in a church meeting. But see if you can find the instructions to bring your branch up to origin/master. As it says, you need to do a pull/merge, and that takes some care. Sometimes I just dump a repository and start fresh I let this happen. (Keep the old one around to make sure you don't lose track of your modifications.)

Joel Rees

Computer memory is just fancy paper,
CPUs just fancy pens.
All is a stream of text
flowing from the past into the future.


Reply to: