Questions tagged [git-patch]
108 questions
1772
votes
29 answers
How can I selectively merge or pick changes from another branch in Git?
I'm using Git on a new project that has two parallel -- but currently experimental -- development branches:
master: import of existing codebase plus a few modifications that I'm generally sure of
exp1: experimental branch #1
exp2: experimental…

David Joyner
- 22,449
- 4
- 28
- 33
1285
votes
8 answers
Create a git patch from the uncommitted changes in the current working directory
Say I have uncommitted changes in my working directory. How can I make a patch from those without having to create a commit?

vrish88
- 20,047
- 8
- 38
- 56
509
votes
13 answers
git: patch does not apply
I have a certain patch called my_pcc_branch.patch.
When I try to apply it, I get following message:
$ git apply --check my_pcc_branch.patch
warning: src/main/java/.../AbstractedPanel.java has type 100644, expected 100755
error: patch failed:…

Glory to Russia
- 17,289
- 56
- 182
- 325
183
votes
5 answers
How can I format patch with what I stash away
In git, I stash away my changes. Is it possible that I can create a patch with what I stash away? And then apply that patch in some other repository (my co-worker's)?
I know git format-patch -1, but I think that it's for what I have committed. But…

silverburgh
- 8,659
- 10
- 31
- 24
175
votes
5 answers
What is a patch in Git version control?
I am new to both Git and version control so I am trying to figure out what a patch is and how is it different from the rest of activities I do in Git?
When do I apply a patch? Does it happen every time I commit?

Amit Erandole
- 11,995
- 23
- 65
- 103
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
130
votes
5 answers
What does "1 line adds whitespace errors" mean when applying a patch?
I'm editing some markdown files of a cloned remote repository, and wanted to test creating and applying patches from one branch to another. However, every time I make any change at all, I get the following message during git apply:
0001-b.patch:16:…

Yarin
- 173,523
- 149
- 402
- 512
102
votes
7 answers
How to apply a git patch from one repository to another?
I have two repositories, one is the main repo for a library, and the other is a project using that library.
If I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream.
The file's location is different…

James Wheare
- 4,650
- 2
- 26
- 22
100
votes
2 answers
How to generate patch for all commits in a branch?
How can I generate patch for all commits in a given branch by knowing only the branch name?
This step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not…

akirekadu
- 2,244
- 3
- 24
- 31
51
votes
5 answers
How to create a patch without commit in Git?
I did some search online. I know that you can use format-patch after commit, but my situation is a little different.
I want to create a patch, similar to "dpk" in SVN, so I can send it out for code review, but I don't yet want to commit it.
How can…

doglin
- 1,651
- 4
- 28
- 38
22
votes
3 answers
Use Git's patience diff algorithm for interactive add
I'd like to use Git's patience diff algorithm (the one you get if you invoke git diff with the --patience argument) with git add -p. How can I do this?
Background: I'm working with some XML files, and git diff's normal algorithm produces pretty poor…

me_and
- 15,158
- 7
- 59
- 96
17
votes
3 answers
Apply Bitbucket pull request as a patch
I've got a repo on Bitbucket that only I have write access to.
Someone forked that repo, made changes and issued a pull request to my repo from the fork.
How can I get that pull request as a git patch to apply temporarily to my repo for testing…

Nick Spiers
- 2,344
- 2
- 19
- 31
15
votes
1 answer
How to create git patch from two files?
I am a newbie to git and I was just wondering, if it's possible to create a git patch from two different file. There is no git repo, the scenario is that I have a file and I modified it, now I want to create a patch with the difference between these…

Pensu
- 3,263
- 10
- 46
- 71
14
votes
4 answers
git: Patch does not have a valid e-mail address
I have a patch-file.
I want to apply this patch to my code in git repository.
When I used subversion this process was quite simple: right click -> tortoise svn -> apply patch. It always works as I expected.
But I cannot do this using git. Git…

tmporaries
- 1,523
- 8
- 25
- 39
11
votes
3 answers
Apply github commit / pull request as a patch
How can I apply the patch from github?
I tried to compile minisat, but I came across two issues from the compilation with clang.
The first issue is solved in this github commit, it's forked from the original github. As the change is minute, I could…

prosseek
- 182,215
- 215
- 566
- 871