Questions tagged [git-patch]

98 questions
1
vote
1 answer

Determing the base SHA of a .patch file

I have a .patch file with two commits in it: From 6551a3bb From Date: Tue, 23 Jun 2015 13:42:58 -0700 Subject: From 224fbe From: Date: Tue, 30 Jun 2015 21:15:16 +0100 Subject: How can I tell what SHA the…
Andrew Lauer Barinov
  • 5,474
  • 9
  • 56
  • 80
1
vote
1 answer

Can git break up changes by default?

I like to use the -p flag on several git commands, such as add, reset, checkout, and stash. But git groups somewhat contiguous changes together in the same hunk. I know that s breaks up the changes but is there another option I could pass to have…
user4316237
1
vote
1 answer

Using Git am when outlook is involved

I am using linux in a virtual machine but my host is windows with outlook installed. Currently when I receive emails containing git patches they pop up in my outlook. How do I apply these patches? They are not sent as attachments, they are sent…
chrispepper1989
  • 1,742
  • 1
  • 19
  • 41
1
vote
2 answers

How can I fetch header info from git patch using python?

is there any command to get email send to / from and date from the git patch file or do I have to read it from the parsing the patch file ?
Ciasto piekarz
  • 6,378
  • 11
  • 59
  • 149
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
  • 5,847
  • 2
  • 26
  • 44
1
vote
2 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,863
  • 1
  • 21
  • 24
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,430
  • 10
  • 60
  • 114
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
  • 11,921
  • 10
  • 50
  • 80
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
  • 15,716
  • 7
  • 69
  • 107
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
  • 73,679
  • 56
  • 267
  • 405
0
votes
1 answer

Implications of removing the index header line from patch

Context I have a git repo ("parent repo") that contains a .patch file I have generated using git diff --binary sometag in another repository ("inner repo"). The parent repo is public and open for pull requests. According to the docs this file…
Max
  • 620
  • 4
  • 22
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
  • 2
0
votes
0 answers

Apply git patch without throwing any error

I have a bash script that applies the patch and check the return code of the command. Here is the output for applying a patch to a file: error: patch failed: routes/web.php:47 Falling back to three-way merge... Applied patch to 'routes/web.php'…
Amarjit Singh
  • 1,693
  • 11
  • 39
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
  • 19,968
  • 18
  • 67
  • 100
0
votes
1 answer

Applying git diff contents from a txt file

A programmer friend sent me a txt-file, containing diff information. Like this, from the beginning of the txt-file content: diff --git a/myfolder/MyClass.java b/myfolder/MyClass.java index 1234aa0d0554..5678bcasas 112233 ---…
Steve Waters
  • 2,637
  • 7
  • 37
  • 80