git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to prepare patch for git am which remove a file ?

From
MMMathieu Malaterre <malat@debian.org>
Date
Nov 20, 2018, 12:39 UTC
Message-ID
<CA+7wUsz5WyRcxMTUWTg13K866vWWp+bVGSZJFU1hRSL1Ehr8Aw@mail.gmail.com>
Here is a simple setup:
  cd /tmp
  mkdir g
  cd g
  git init .
  wget http://central.maven.org/maven2/org/apache/xmlgraphics/fop/2.1/fop-2.1.pom
  git add fop-2.1.pom
  git commit -m "My First Commit"
  git rm fop-2.1.pom
  git commit -m "Second Commit"
  git format-patch HEAD~
  git reset --hard HEAD~
  git am 0001-Second-Commit.patch
Applying: Second Commit
error: patch failed: fop-2.1.pom:1
error: fop-2.1.pom: patch does not apply
Patch failed at 0001 Second Commit
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

What is the black magic to get `git am` to understand this patch ? Please note that:

$ patch --dry-run -p1 < 0001-Second-Commit.patch checking file fop-2.1.pom

Thanks!
Next: SZEDER Gábor
Message 1 of 3 in “How to prepare patch for git am which remove a file ?”
  1. Mathieu MalaterreNov 20, 2018
  2. SZEDER GáborNov 20, 2018
  3. Mathieu MalaterreNov 20, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.