Questions tagged [git-patch]
108 questions
2
votes
0 answers
A manual git checkout patch which simply will not apply
I'm a relative newcomer to Git, but I've been learning some more advanced stuff as I've been working on a game design competition. In the process of trying to splice changes between two branches, I've been introduced to git checkout --patch, which…

MutantOctopus
- 3,431
- 4
- 22
- 31
2
votes
1 answer
How to fix one or more hunks were rejected in the patch you just applied error?
While applying patch in git, I am getting the below error if I have same files modified in working copy which were there in patch.
One or more hunks were rejected in the patch you just applied, you
will find the hunk in '.rej' files of the same…

Surendra Reddy
- 219
- 3
- 10
2
votes
1 answer
GIT stash apply reverse doesn't work with js and rb files
I'm trying to figure out why GIT does not apply reverse patch on javascript and ruby files, but does it on php files. My steps are:
...modifying some php, ruby and js files...
git stash #saving changes into stash
git stash apply #applying them
git…

tijs
- 566
- 4
- 12
1
vote
2 answers
git merge between different repositories
I created a repository with git-svn from a big svn repository (git svn clone).
I've several local commits in my git repository that I don't need to push to svn but I will need to get updates from it.
Now I realized that I don't need the entire svn…

Andrea Polci
- 1,011
- 13
- 27
1
vote
1 answer
Taking your work Hostage with git?
Here's the situation...
I need to be able to rebase a git repository branch to a point in time, then remove (and stash or keep) my commits beyond that point in time. Retaining the ability to re-apply every thing... but not having them living in the…

jondavidjohn
- 61,812
- 21
- 118
- 158
1
vote
2 answers
git apply is not respecting file renames using `git mv`
I have created a diff of my changes from other branch called `main like so:
// while on another branch that is not `main`
git diff main > my-diff.patch
however when I run git apply my-diff.patch, I see that my file renames (using git mv) are not…

Clifford Fajardo
- 1,357
- 1
- 17
- 28
1
vote
0 answers
Is it possible to undo a `git add` and go to the exact same staging index as before?
I was trying to split my work into multiple commits. I have done this:
git add --patch my_file
# accepted, rejected, manually edited many hunks
# --->
# now my silly mistake comes
git add my_file
git commit -m "some commit message"
I shouldn't have…

Asocia
- 5,935
- 2
- 21
- 46
1
vote
1 answer
How to add new git repository file thru git patch
There are two Repositories : project-version-1 and project-version-2.
project-version-1 dir has files : calculator/src/add.c calculator/src/subtract.c calculator/src/multiply.c and it does not have support for some feature (say division…

jeshmal4u
- 41
- 3
1
vote
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
- 965
- 1
- 10
- 28
1
vote
2 answers
git: Undo specific changes in modified postman collection programmatically
I work with postman collections in git. Postman does a lot of things well, but the id regeneration that occur when you import are not ideal.
Essentially importing a postman collection, and exporting it again results in a change for every id
e.g.…

JoSSte
- 2,953
- 6
- 34
- 54
1
vote
1 answer
Git patch from several (not all) unstaged files
I read about git patch command, but all of the examples show how to get a patch for all not staged or cached files or even all files that some commit includes (from one commit till another). But suppose I have 10 not staged files and I need to…

z0lupka
- 236
- 4
- 19
1
vote
1 answer
See the full git add patch
I use git add -p all the time. For large hunks I often go into (e)dit mode to review and adjust the hunk as desired.
Is there a way to edit the FULL diff (every hunk in every file), rather than make staging decisions one hunk at a time?
I know you…

Taylor Vance
- 706
- 1
- 8
- 22
1
vote
0 answers
How to edit patch for git add in vscode?
I tried to edit git add --patch using interactive git add.
so first git add -i then What for>p then e for editing patch
(I set my settings for editor with vscode not vim)
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -1,5 +1,16 @@
…

devstefancho
- 2,072
- 4
- 17
- 34
1
vote
1 answer
How to get a git log for a line from a patch?
I get a patch using command:
git format-patch -1 --numbered-files --unified=100000 -o tmpdir commit_sha1 --file_name
Now I'm interested in a specific line from a specific file from the patch. I want to see the change history of this line.
I could…

Maria
- 21
- 3
1
vote
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
- 3,348
- 9
- 54
- 94