Questions tagged [git-patch]
108 questions
1
vote
1 answer
how to store git format-patch data to a variable instead of writing to a file?
how to store git format-patch output to a variable instead of writing to a disk using python?
or is there any other way to create a git diff with subject line ?

Ciasto piekarz
- 7,853
- 18
- 101
- 197
1
vote
0 answers
Viewing git patch without context
Since apart from the actual changes, each patch contains a little bit of surrounding lines,
I wanted to use that information and present me a side-by-side comparison with nice visual representation edited lines, removed lines and so on - the one…

vucalur
- 6,007
- 3
- 29
- 46
1
vote
3 answers
How does one copy commits without producing different SHA1s?
As much as I've tried to avoid it, I have to maintain three master-equivalient branches with minor changes in each one. I've been reading about git and using it for a couple of years, so I'm familiar with the following conventional wisdom:
Don't…

jrhorn424
- 1,981
- 2
- 21
- 27
1
vote
1 answer
Git: Create a patch from a list of certain files
I want to create a patch from a list of files. For example I have 10 commits which modify 4 files. I want to create a patch that includes changes of 3 of those 4 files during those 10 commits. How can I do that?

Jacob Krieg
- 2,834
- 15
- 68
- 140
1
vote
1 answer
git add patch on file with parentheses in the file path
I want to run git add -p on a file with a full path that includes parentheses, like so:
git add -p "(External)/Project/Filename.cs"
However, when I run this, I get the following error:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c:…

Ryan Kohn
- 13,079
- 14
- 56
- 81
0
votes
0 answers
How to remove changes related to one file from patch
I've got a patch created with git format-patch and when trying to apply it to master I faced that some file changes are now obsolete and there's no reason to apply them. Example:
git apply 00001-my.patch
error: patch failed: my_file.c:68
error:…

Some Name
- 8,555
- 5
- 27
- 77
0
votes
1 answer
git apply patch does not update commit id
I have a network on computers all of which have access to the same git repository. This network will not have access to the internet and I'm trying to find a way to be able to update the git repositories on all computers. I can upload files to the…

EmaadP
- 160
- 1
- 1
- 10
0
votes
1 answer
Automerge after patch apply with conflics
I have several repositories with "just the same" package.json and several config files. I have changes made in one repository and want to spread this changes on others. I managed to do just the right thing following these instructions:
git…

arsonist
- 175
- 1
- 11
0
votes
0 answers
Create patch or diff file from git repository for target directory and apply it to another different git repository with different directory
Here is similar question.
git format-patch -k R1..R2
But I want only commits from current directory and removing relative path or change path at all
For example by doing:
git format-patch -k R1..R2 .
I get patches with…

Eugen Konkov
- 22,193
- 17
- 108
- 158
0
votes
1 answer
How to create a git patch with the parent SHA so it can serve as an archive?
Imagine I'm working on an exploratory branch on a git repo and it only has one commit. I decide that my work is not needed any time soon, and I don't want to create a branch/tag. In fact, I'd like to throw away the changes, but just in case I ever…

Senseful
- 86,719
- 67
- 308
- 465
0
votes
2 answers
GIT Patches - or - Push?
We are considering 2 ways for working with git in a new project :
Developers sends patches to maintainer ( which will probably end up being one of the developers ) , he apples those, test and integrate
Developers pushes their commits to the public…

ran wainstein
- 21
- 1
- 1
- 3
0
votes
1 answer
"error: ... patch does not apply" when editing hunk with "git add -p"
tldr: why am I getting error: ... patch does not apply when editing a hunk and removing a line, even though it looks like it should work?
I'm editing a hunk while doing git add -p, where I want to only add new line 1 (and not add new line 2):
#…

Rob Bednark
- 25,981
- 23
- 80
- 125
0
votes
0 answers
Git diff patch failed at git apply
I have generated the patch with the below git command
git diff -b -w lib/web/mage/requirejs/mixins.js > mixinjs.patch
When I applied the patch I got the below error
$ git apply --check --reverse --verbose mixinjs.patch
Checking patch…

Bilal Usean
- 2,322
- 3
- 22
- 45
0
votes
1 answer
Display git diff in merge resolution format
Is there a way to format a git diff (e.g. git diff HEAD^ or git diff origin/foo origin/bar) in the format used by merge resolution?
For example, I have a patch which (in part) looks like
yield (
api.test('check the foos') + #
- …

Jacob Kopczynski
- 392
- 3
- 13
0
votes
2 answers
git am: Patch format detection failed. git apply also fails
I'm trying to learn git patching, so I set up a test repo and made a few commits.
I then created a patch: git format-patch -1 HEAD --stdout > changes.patch
Next, I checked out a new branch and tried to use changes.patch: git am .\changes.patch. It…

Danation
- 743
- 8
- 20