---
# System prepended metadata

title: 'Git am failed, what''t next?'

---

# Git am failed, what't next?

From Andy's reply in https://git.vger.kernel.narkive.com/laHrDpJG/am-failed-what-s-next

* 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.