git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Scott Bronson <bronson@rinspin.com>
Cc: git@vger.kernel.org
Subject: Re: Interpreting git merge failures
Date: Tue, 12 Jul 2011 09:40:29 -0700	[thread overview]
Message-ID: <7vy6038nb6.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAKmUPx5Qt2K+7F+BsW3WTmRjodBSrteuyG8p9oRHZuhApTu4+g@mail.gmail.com> (Scott Bronson's message of "Thu, 7 Jul 2011 11:45:57 -0700")

Scott Bronson <bronson@rinspin.com> writes:

> What is the best way to determine why a git merge failed?

If you get exit code 0, the merge did not fail.

Otherwise you can inspect the index after getting the non-zero exit code.

If you have an unmerged entry in the index, there could be two cases.  The
most typical is that the merge was attempted and stopped due to an
conflict. "ls-files -u" will show these paths. Another is a user error to
run "git merge" when your index is already unmerged, but you can easily
avoid this at the beginning of your script, stopping without running "git
merge" when the index is unmerged to begin with.

If you do not have an unmerged entry in the index, the merge refrained
from overwriting either your local modifications in the working tree, or
your local modifications to the index.  Again the latter is a user error
that you can detect before running "git merge" in your script.

      parent reply	other threads:[~2011-07-12 16:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 18:45 Interpreting git merge failures Scott Bronson
2011-07-12  6:33 ` Jeff King
2011-07-12 16:40 ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vy6038nb6.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bronson@rinspin.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).