Questions tagged [format-patch]

generate patches with git to be applied manually later on

Used mainly with git to generate patches, you can read more about the documentation at git-scm. The linux kernel is one project which extensively uses patches for development.

48 questions
1609
votes
11 answers

How can I generate a Git patch for a specific commit?

I need to write a script that creates patches for a list of SHA-1 commit numbers. I tried using git format-patch , but that generated a patch for each commit since that SHA-1 value. After a few hundred patches were generated, I had to kill…
elle
  • 16,125
  • 3
  • 15
  • 4
101
votes
8 answers

Git format-patch to be svn compatible?

Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo? I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do…
rip747
  • 9,375
  • 8
  • 36
  • 47
42
votes
6 answers

How can I make git am / git apply work "fuzzy" like the patch command

I've been using git-format-patch and git-am to apply changes from one repository to another. The file structures are the same but there are some changes in the repository I'm apply to which cause most patches to fail a few hunks. But most of the…
EdC
  • 2,309
  • 1
  • 17
  • 30
38
votes
5 answers

what is the first line of git format-patch output?

when running git format-patch, the intent is to create an email representation of the code you wrote. So far so good. I'm no email expert, but it seems to me that the first line of this format-patch output isn't in a standard email header…
Chris H
  • 6,433
  • 5
  • 33
  • 51
24
votes
3 answers

How to use git format-patch on initial commit

I need to get patch file for inital commit (which is not empty) for our review process, but I'm confused as git format-patch command only makes it from branch that is on initial commit not including it. Seems it must be some obvious move but I'm…
Vlad Fedin
  • 498
  • 5
  • 8
18
votes
4 answers

How to email patches formatted with git format-patch?

I've got a series of patches I want to send to an open source project but I'm not able to figure out how to properly format an email. I tried running a git format-patch command then attached them all into an email from Thunderbird but they all got…
Chris H
  • 6,433
  • 5
  • 33
  • 51
13
votes
4 answers

git am/format-patch: control format of line endings

I created a patch from three commits using git format-patch This creates three patch files that I mailed from my notebook and read the mail on my desktop computer (both are Windows boxes). When I do now git am --3way…
eckes
  • 64,417
  • 29
  • 168
  • 201
8
votes
4 answers

git format-patch for all the commits to a file

I want to get patches for all commits that are made to a file/folder. I can get the list of commit-id through git log --format="%H"-- path/to/folder Is there a way i can get generate patches from this list. [edit]: below code partly solves my…
prahlad venkata
  • 351
  • 2
  • 6
8
votes
1 answer

Git format-patch patches can't use LFS across different repositories

We are currently migrating from CVS to a git repository. One team however already used cvs2git about a year ago for their repository because their new feature needs a lot of moving files with history which CVS is historically not very good at. The…
7
votes
1 answer

How to quickly get a patch from a specific commit in GitHub?

I have a specific commit on a GitHub repository from which I want to extract a patch to apply in a different place, similar what I would get when using git format-patch. I am lazy or the repository is too big and I don't want to fetch the whole…
batista
  • 181
  • 2
  • 10
6
votes
1 answer

Apply git patch created with git diff

I am trying to move uncommited changes from a local git repository to another local repository. On repo 1 I create a patch like this: git diff > my_patch.patch Inspecting the patch: more my_patch.patch I get the same output as running git diff on…
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
5
votes
1 answer

How to re-format the patch after merge in Git?

Let's assume that there are two branches, master and slave, and they edit the same file and the same line. Initially, the contents of the file is foo bar then in the branch slave it is edited to become foo bar baz Now the user of branch slave…
sastanin
  • 40,473
  • 13
  • 103
  • 130
4
votes
0 answers

git add --patch hunk edition: How to remove context lines?

I am currently presented with the following situation: # Manual hunk edit mode -- see bottom for a quick guide. @@ -10130,7 +10160,22 @@ function myGreatFunc(param1, param2 let a = funcA(b, c); if(funcB(a, d.a.a) >= e) { -…
Bernard Rosset
  • 4,523
  • 6
  • 27
  • 29
4
votes
0 answers

git format-patch in multiple-branch setup

1. Abstract My ultimate goal is to bring some Client's changes done on a Client's branch in the linux-kernel repo to another linux-kernel repository, given the fact that both have a common base tag (e.g. v4.2, from which the Client's branch has been…
Eugeniu Rosca
  • 5,177
  • 16
  • 45
1
2 3 4