Questions tagged [git-am]

Git command for applying a series of patches from a mailbox.

37 questions
140
votes
4 answers

When applying a patch is there any way to resolve conflicts?

I am on windows. For various reasons we have multiple git instances of different svn branches. Many times I want to fix an issue in repository A, generate a patch, and apply it to repository B. This works fine except if there are conflicts. When…
Kenoyer130
  • 5,806
  • 8
  • 46
  • 69
112
votes
6 answers

How to apply a Git patch to a file with a different name and path?

I have two repositories. In one, I make changes to file ./hello.test. I commit the changes and create a patch from that commit with git format-patch -1 HEAD. Now, I have a second repository that contains a file that has the same contents as…
mart1n
  • 5,135
  • 5
  • 35
  • 72
20
votes
2 answers

What to do if git-am fails with “does not exist in index”?

I have a patch that gives out the following output when I try to apply it with git am Checking patch old/filename... error: old/filename: does not exist in index Within the patch old/filename is actually moved to new/filename but it seems the…
a1an
  • 2,914
  • 5
  • 32
  • 49
9
votes
3 answers

git - cherry-pick - HOWTO / WHYTO

Problem: You want to test a feature someone has developed, but it only exists in a remote branch which is woefully out of date. Source How does cherry-pick solve the problem? Why won't I use git am or git apply?
0x90
  • 34,073
  • 33
  • 137
  • 218
9
votes
2 answers

git am should ignore something in commit message startswith "[]"?

I have a commit with message like [Hello World]Something. Then I use git format-patch HEAD~1 to crate a patch. Content of patch like this: Subject: [PATCH 1/7] [Hello World] Something. But after I use git am to apply patch,the commit message became…
Sunny
  • 117
  • 6
8
votes
2 answers

What is the difference between git cherry-pick and git format-patch | git am?

I sometimes need to cherry-pick a tag with a certain fix into my branch, and used to do so via git cherry-pick tags/myfix This works, but cherry-picking takes an increasingly long time doing "inexact rename detection". My hunch was that this could…
Felix Dombek
  • 11,461
  • 15
  • 67
  • 116
6
votes
0 answers

git apply error no such file or directory

I have two sepearate git repos: A and B. Some repository B files are already present in a subfolder of project A. My goal is to create patches for repo B and then applying them to the subfolder within repo A to conserve history of repo B while…
sid99
  • 61
  • 1
  • 2
6
votes
1 answer

Failed patch changed my Git Bash prompt, how do I revert it?

I tried to apply a patch using git am
sashoalm
  • 63,456
  • 96
  • 348
  • 677
6
votes
1 answer

Git format-patch/bundle for human-readable sneakernet "pull/push"

I have two rooms in which I maintain some source code using git, a "dev" room where most development happens and a "deploy" room in which we actually use the software. Inevitably some changes happen in the deploy room as well. I'd like both rooms…
L. Robison
  • 121
  • 1
  • 8
4
votes
2 answers

Resolve conflicts from am session

I wanted to cherry pick multiple commits from one repository to another. I followed the instructions provided from this Stack Overflow post: /path/to/2 $ git --git-dir=/path/to/1/.git format-patch --stdout sha1^..sha1 | git am -3 And a conflict…
MHogge
  • 4,504
  • 12
  • 45
  • 86
4
votes
1 answer

git am error: “error: while searching for:”

running git am I get error above. Comparing by hand I do not see any problem. May someone point me where the error is? $ git am 0012-Do-not-die-when-something-nasty-happen-in-the-comman.patch --reject Applying: Do not die when something nasty happen…
Eugen Konkov
  • 15,716
  • 7
  • 69
  • 107
3
votes
0 answers

git-am with mailbox patch fails when it contains a cover letter

When running git-am to apply a patch series I had saved into an mbox file from a mailing list, if the mbox also contains the cover letter (otherwise known as PATCH [0/N]), it complains as follows: 128 git … am --3way ~/patches/sample.mbox Patch is…
Larunbe
  • 31
  • 1
3
votes
1 answer

How to 'git-am' apply a patch created with 'git-format-patch --no-prefix'?

I have a reason¹ to create my git commits as patch files using git-format-patch with the --no-prefix option. This option changes the patch output to not add the git-diff-specific prefixes a/ / b/ in file paths in the patch files. It allows tools…
gertvdijk
  • 21,668
  • 5
  • 32
  • 56
3
votes
2 answers

Error on git patch using git am

When I try to perform a patch using: git am 0001-someFile.patch but I get this error: error: patch failed: src/***/file.c:459 error: src/***/file.c: patch does not apply Patch failed at 0001 someFile.patch When you have resolved this problem run…
Itzik984
  • 13,250
  • 24
  • 66
  • 100
3
votes
2 answers

git am is choking characters from my commit messages

I'm using some private annotations in my git commit messages. For example, when I fixed something in module MOD_A, the commit message looks like this: FIX [MOD_A] Fixed something As long as there's FIX in front of [MOD_A], everything works fine if…
eckes
  • 56,506
  • 25
  • 151
  • 189
1
2 3