All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Forman <petef4+usenet@gmail.com>
To: git@vger.kernel.org
Subject: How to pre-empt git pull merge error?
Date: Wed, 27 Nov 2013 15:17:27 +0000	[thread overview]
Message-ID: <86d2llc1rs.fsf@gmail.com> (raw)

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

Here git okay is a place holder for the command I am asking for.

If a file has been changed outside of a commit then git pull fails with
the following error.

error: Your local changes to '...' would be overwritten by merge.
Aborting. Please, commit your changes or stash them before you can
merge.

I would like git okay to perform the pre-merge checks described in git
merge and return non-zero status so that the script aborts before the
server is stopped.

Possibilities I have looked for and not found include git merge
--dry-run. My best line of thought is git status --porcelain |
pre-merge-okay. That seems like a lot of work to make a pre-merge-okay
that deals with things like benign untracked files.

I have also asked this question on Stack Overflow but received no
answers.

http://stackoverflow.com/questions/20221383/

-- 
Pete Forman

             reply	other threads:[~2013-11-27 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 15:17 Pete Forman [this message]
2013-11-27 15:42 ` How to pre-empt git pull merge error? 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

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=86d2llc1rs.fsf@gmail.com \
    --to=petef4+usenet@gmail.com \
    --cc=git@vger.kernel.org \
    /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.