git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: "Francis Moreau" <francis.moro@gmail.com>
Subject: Re: git-am failed, what's next ?
Date: Thu, 22 Feb 2007 08:48:05 +0000	[thread overview]
Message-ID: <200702220848.06637.andyparkins@gmail.com> (raw)
In-Reply-To: <38b2ab8a0702220022wab25519hbb57629934e7f104@mail.gmail.com>

On Thursday 2007 February 22 08:22, Francis Moreau wrote:

> ----
> error: patch failed: foo:1
> error: foo: patch does not apply
>
> Patch failed at 0001.
> When you have resolved this problem run "git-am --resolved".
> If you would prefer to skip this patch, instead run "git-am --skip".
> ---

I've often wished for more information from git-am (or more correctly, 
git-apply).  However, you can sometimes get what you need to know another 
way.

 * First, make sure that your current tree is checked in so you can get back
   to it easily.  Maybe switch to a new temporary branch to make it easy to
   return to your current point.
 * Then run git-am to get the number of the failing patch, in your example 
   it's "0001"
 * Now, try and apply the patch manually, but turn on verbose and reject in 
   git-apply
    $ git-apply --verbose --reject .dotest/0001
   This is the only way I've found to get git to tell you which hunk of the
   patch is being rejected.  Unfortunately, it will also leave you with that
   patch partially applied.
 * Sometimes the partially applied patch will be enough.  Have a look at the
   *.rej files that have been created and see if you can resolve the conflict
   by hand - you could apply the patch by hand if it's only a small hunk.
   If you do this, you can then continue with the git-am by first updating the 
   index (git-add somefile.c), then running git-am --resolved
 * If you wanted to you could just skip that patch with "git-am --skip"
 * If you wish you hadn't started any of this you can obviously use git-reset 
   to get you back to the start point.

Hope that helps.


Andy

-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

  reply	other threads:[~2007-02-22  8:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22  8:22 git-am failed, what's next ? Francis Moreau
2007-02-22  8:48 ` Andy Parkins [this message]
2007-02-22 10:09   ` Francis Moreau
2007-02-22  9:47 ` Junio C Hamano
2007-02-22 10:38   ` Francis Moreau
2007-02-22 19:30     ` Junio C Hamano
2007-02-22 10:50   ` Francis Moreau
2007-02-22 11:13   ` Andy Parkins
2007-02-22 20:02     ` Junio C Hamano
2007-02-22 19:11 ` Johannes Schindelin

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=200702220848.06637.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=francis.moro@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 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).