All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Thomas Rast <tr@thomasrast.ch>,
	Konstantin Khomoutov <flatworm@users.sourceforge.net>,
	Pete Forman <petef4+usenet@gmail.com>, git <git@vger.kernel.org>
Subject: Re: How to pre-empt git pull merge error?
Date: Wed, 27 Nov 2013 12:09:15 -0800	[thread overview]
Message-ID: <xmqqvbzdsj2s.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CALWbr2wNODeLSmQ5ztQmKVxBSguNJ1bbSbvY66sdsP09dSUUgA@mail.gmail.com> (Antoine Pelisse's message of "Wed, 27 Nov 2013 17:38:46 +0100")

Antoine Pelisse <apelisse@gmail.com> writes:

>>> On Wed, 27 Nov 2013 15:17:27 +0000
>>> Pete Forman <petef4+usenet@gmail.com> wrote:
>>>
>>>> I am looking for a way of detecting up front whether a git pull or git
>>>> merge would fail. The sort of script I want to perform is to update a
>>>> server.
>>>>
>>>>     git fetch
>>>>     git okay
>>>>     stop server
>>>>     backup data
>>>>     git merge
>>>>     start server
>>>>
>> I don't know a simple way to do the pre-merge check without actually
>> doing the merge (other than patching git merge to add a --dry-run
>> option)
>
> Wouldn't that be a nice use-case for git-recursive-merge --index-only
> ($gmane/236753) ?

As the original mentions "error: Your local changes to ...", I do
not think it would be a good fit.

I have to say that the safest and sanest way may be to:

 (1) Commit any such local change(s);

     server$ git commit -a

 (2) Pull that down to a pre-deploy repository from the "server";

     prepare$ git pull ...to grab the "local changes" above...

 (3) Merge in whatever the update you want to have on the "server";

     prepare$ git merge ...whatever...

 (4) and then stop the server, fast-forward to the result of (3),
     and then restart.

     server$ stop server
     server$ git pull --ff-only ...the prepared result of (3)...
     server$ start server

      parent reply	other threads:[~2013-11-27 20:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 15:17 How to pre-empt git pull merge error? Pete Forman
2013-11-27 15:42 ` Konstantin Khomoutov
2013-11-27 15:54   ` Matthieu Moy
2013-11-27 16:38     ` Antoine Pelisse
2013-11-27 19:06       ` Thomas Rast
2013-11-28  8:25         ` Pete Forman
2013-11-27 20:09       ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqvbzdsj2s.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=apelisse@gmail.com \
    --cc=flatworm@users.sourceforge.net \
    --cc=git@vger.kernel.org \
    --cc=petef4+usenet@gmail.com \
    --cc=tr@thomasrast.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.