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

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

 



On Wed, 27 Nov 2013 15:17:27 +0000
Pete Forman <petef4+usenet@xxxxxxxxx> 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
> 
> 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.

What's wrong with "git okay" being

if git merge whatever 2>/dev/null; then
  ... OK path
else
  ... "merge failed" path
fi

?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]