Questions tagged [git-am]

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

39 questions
171
votes
5 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
  • 6,874
  • 9
  • 51
  • 73
143
votes
5 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,969
  • 5
  • 46
  • 83
24
votes
4 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
  • 3,526
  • 5
  • 37
  • 57
14
votes
2 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
  • 141
  • 1
  • 1
  • 3
10
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
  • 13,664
  • 17
  • 79
  • 131
10
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
  • 39,472
  • 36
  • 165
  • 245
10
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
  • 127
  • 7
8
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
  • 151
  • 1
  • 9
7
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
  • 5,408
  • 15
  • 61
  • 104
7
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
  • 75,001
  • 122
  • 434
  • 781
6
votes
1 answer

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
  • 61
  • 2
6
votes
2 answers

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
  • 24,056
  • 6
  • 41
  • 67
6
votes
1 answer

Cannot use `git mergetool` with `git am` or `git apply` or `patch`

git mergetool is wonderful (in my case, I use kdiff3). However, it is not possible to use it to resolve conflicts from git am or git apply (or even with patch command). Indeed, mergetool need 3 files to work (base and both modified versions) while…
Jérôme Pouiller
  • 9,249
  • 5
  • 39
  • 47
6
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
  • 22,193
  • 17
  • 108
  • 158
4
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
  • 15,968
  • 28
  • 69
  • 107
1
2 3