git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to pre-empt git pull merge error?
@ 2013-11-27 15:17 Pete Forman
  2013-11-27 15:42 ` Konstantin Khomoutov
  0 siblings, 1 reply; 7+ messages in thread
From: Pete Forman @ 2013-11-27 15:17 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-28  8:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).