Can I get a patch out of git with only the conflicts?
I am using git
and am rebasing a branch on top of another branch. During the rebase there are conflicts. Can I get a patch
file with only the conflicts?
Originally, I thought that during the rebase, when I have all the conflicts unmerged/unstaged, I can do the following:
$ git diff > /tmp/conflicts.patch
However, when I try to apply the resulting patch, it fails:
$ git rebase --abort
$ git apply /tmp/conflicts.patch
error: unrecognized input
$ patch -p1 < /tmp/conflicts.patch
patch: **** Only garbage was found in the patch input.
I also tried to diff with the --no-prefix
option, but the result was the same.
To be honest, I have never worked with patch files, but neither patch
nor git
are very helpful with their error messages, so googling didn't provide much info.
Any ideas? This is an excerpt of the resulting patch:
diff --cc app/common/models/api/requests/index.js
index c9bf20d,7578fbb..0000000
--- a/app/common/models/api/requests/index.js
+++ b/app/common/models/api/requests/index.js
@@@ -12,7 -12,9 +12,11 @@@ require('./NewUserDS')
require('./NewSubscriptionDS');
require('./PasswordResetRequestDS');
require('./RefreshTokensRequestDS');
-require('./TwoFactorConfirmationRequestDS');
require('./UpdateUserRequestDS');
-require('./UserAddressRequestDS');
-require('./PicOptimizationDS');
require('./ProxyRequestDS');
++<<<<<<< HEAD
+require('./GDPRPreferencesDS');
+
++=======
+ require('./ListTournamentsQuery');
++>>>>>>> (#36) Implement Multiple Streams for single match
git patch
add a comment |
I am using git
and am rebasing a branch on top of another branch. During the rebase there are conflicts. Can I get a patch
file with only the conflicts?
Originally, I thought that during the rebase, when I have all the conflicts unmerged/unstaged, I can do the following:
$ git diff > /tmp/conflicts.patch
However, when I try to apply the resulting patch, it fails:
$ git rebase --abort
$ git apply /tmp/conflicts.patch
error: unrecognized input
$ patch -p1 < /tmp/conflicts.patch
patch: **** Only garbage was found in the patch input.
I also tried to diff with the --no-prefix
option, but the result was the same.
To be honest, I have never worked with patch files, but neither patch
nor git
are very helpful with their error messages, so googling didn't provide much info.
Any ideas? This is an excerpt of the resulting patch:
diff --cc app/common/models/api/requests/index.js
index c9bf20d,7578fbb..0000000
--- a/app/common/models/api/requests/index.js
+++ b/app/common/models/api/requests/index.js
@@@ -12,7 -12,9 +12,11 @@@ require('./NewUserDS')
require('./NewSubscriptionDS');
require('./PasswordResetRequestDS');
require('./RefreshTokensRequestDS');
-require('./TwoFactorConfirmationRequestDS');
require('./UpdateUserRequestDS');
-require('./UserAddressRequestDS');
-require('./PicOptimizationDS');
require('./ProxyRequestDS');
++<<<<<<< HEAD
+require('./GDPRPreferencesDS');
+
++=======
+ require('./ListTournamentsQuery');
++>>>>>>> (#36) Implement Multiple Streams for single match
git patch
2
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neitherpatch
norgit apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".
– torek
Nov 20 '18 at 15:56
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
That sounds right, but you might also want to look atgit rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.
– torek
Nov 20 '18 at 17:44
add a comment |
I am using git
and am rebasing a branch on top of another branch. During the rebase there are conflicts. Can I get a patch
file with only the conflicts?
Originally, I thought that during the rebase, when I have all the conflicts unmerged/unstaged, I can do the following:
$ git diff > /tmp/conflicts.patch
However, when I try to apply the resulting patch, it fails:
$ git rebase --abort
$ git apply /tmp/conflicts.patch
error: unrecognized input
$ patch -p1 < /tmp/conflicts.patch
patch: **** Only garbage was found in the patch input.
I also tried to diff with the --no-prefix
option, but the result was the same.
To be honest, I have never worked with patch files, but neither patch
nor git
are very helpful with their error messages, so googling didn't provide much info.
Any ideas? This is an excerpt of the resulting patch:
diff --cc app/common/models/api/requests/index.js
index c9bf20d,7578fbb..0000000
--- a/app/common/models/api/requests/index.js
+++ b/app/common/models/api/requests/index.js
@@@ -12,7 -12,9 +12,11 @@@ require('./NewUserDS')
require('./NewSubscriptionDS');
require('./PasswordResetRequestDS');
require('./RefreshTokensRequestDS');
-require('./TwoFactorConfirmationRequestDS');
require('./UpdateUserRequestDS');
-require('./UserAddressRequestDS');
-require('./PicOptimizationDS');
require('./ProxyRequestDS');
++<<<<<<< HEAD
+require('./GDPRPreferencesDS');
+
++=======
+ require('./ListTournamentsQuery');
++>>>>>>> (#36) Implement Multiple Streams for single match
git patch
I am using git
and am rebasing a branch on top of another branch. During the rebase there are conflicts. Can I get a patch
file with only the conflicts?
Originally, I thought that during the rebase, when I have all the conflicts unmerged/unstaged, I can do the following:
$ git diff > /tmp/conflicts.patch
However, when I try to apply the resulting patch, it fails:
$ git rebase --abort
$ git apply /tmp/conflicts.patch
error: unrecognized input
$ patch -p1 < /tmp/conflicts.patch
patch: **** Only garbage was found in the patch input.
I also tried to diff with the --no-prefix
option, but the result was the same.
To be honest, I have never worked with patch files, but neither patch
nor git
are very helpful with their error messages, so googling didn't provide much info.
Any ideas? This is an excerpt of the resulting patch:
diff --cc app/common/models/api/requests/index.js
index c9bf20d,7578fbb..0000000
--- a/app/common/models/api/requests/index.js
+++ b/app/common/models/api/requests/index.js
@@@ -12,7 -12,9 +12,11 @@@ require('./NewUserDS')
require('./NewSubscriptionDS');
require('./PasswordResetRequestDS');
require('./RefreshTokensRequestDS');
-require('./TwoFactorConfirmationRequestDS');
require('./UpdateUserRequestDS');
-require('./UserAddressRequestDS');
-require('./PicOptimizationDS');
require('./ProxyRequestDS');
++<<<<<<< HEAD
+require('./GDPRPreferencesDS');
+
++=======
+ require('./ListTournamentsQuery');
++>>>>>>> (#36) Implement Multiple Streams for single match
git patch
git patch
asked Nov 20 '18 at 15:52
ShadeShade
7,03944775
7,03944775
2
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neitherpatch
norgit apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".
– torek
Nov 20 '18 at 15:56
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
That sounds right, but you might also want to look atgit rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.
– torek
Nov 20 '18 at 17:44
add a comment |
2
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neitherpatch
norgit apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".
– torek
Nov 20 '18 at 15:56
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
That sounds right, but you might also want to look atgit rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.
– torek
Nov 20 '18 at 17:44
2
2
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neither
patch
nor git apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".– torek
Nov 20 '18 at 15:56
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neither
patch
nor git apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".– torek
Nov 20 '18 at 15:56
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
That sounds right, but you might also want to look at
git rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.– torek
Nov 20 '18 at 17:44
That sounds right, but you might also want to look at
git rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.– torek
Nov 20 '18 at 17:44
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396771%2fcan-i-get-a-patch-out-of-git-with-only-the-conflicts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396771%2fcan-i-get-a-patch-out-of-git-with-only-the-conflicts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
The short answer is "no": these diffs are combined diffs, which show two different sets of changes combined, and omit some changes, and no patch-like program (neither
patch
norgit apply
) can deal with that. Applying a patch means "one input, one output" not "two partial inputs, one partial outputs".– torek
Nov 20 '18 at 15:56
@torek thanks for the comment - that's at least pointing me in a direction. I don't necessarily want to use only the tools or the approach that I have described above. If you could suggest an alternative, that would be even more helpful.
– Shade
Nov 20 '18 at 16:04
Hmm, having thought more about this, it really seems that I want to achieve something impossible - I want to resolve future merge/rebase conflicts without actually merging/rebasing, which seems to be impossible, since the changes that would "resolve" the future conflicts would themselves conflict when actually merging/rebasing...
– Shade
Nov 20 '18 at 16:29
That sounds right, but you might also want to look at
git rerere
(which re-uses re-corded re-solutions, hence the silly name). Essentially, you just enable it then do the merge, and Git records what you did and does the same thing again next time.– torek
Nov 20 '18 at 17:44