Thread (1 message) 1 message, 1 author, 2016-06-15

Re: How to pre-empt git pull merge error?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:20

Antoine Pelisse [off-list ref] writes:
quoted
quoted
On Wed, 27 Nov 2013 15:17:27 +0000
Pete Forman [off-list ref] wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help