rollback to develop branch without last merge feature
I made a mistake merging my last feature with develop; I had just to finish my feature and then do a PR, and then merge trought github.
What is the right method to go back to before I merge my last feature ?
I'm confused about when do 'git push', and really with a PR , I don't must use anymore git finish feature, not ? because this last merge, and I need to do PR to pass circle tests.
can I delete my remote branch (because i have a local with the same name)? before do push? that is better? in case of conflicts with the remote?
git
add a comment |
I made a mistake merging my last feature with develop; I had just to finish my feature and then do a PR, and then merge trought github.
What is the right method to go back to before I merge my last feature ?
I'm confused about when do 'git push', and really with a PR , I don't must use anymore git finish feature, not ? because this last merge, and I need to do PR to pass circle tests.
can I delete my remote branch (because i have a local with the same name)? before do push? that is better? in case of conflicts with the remote?
git
1
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
2
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58
add a comment |
I made a mistake merging my last feature with develop; I had just to finish my feature and then do a PR, and then merge trought github.
What is the right method to go back to before I merge my last feature ?
I'm confused about when do 'git push', and really with a PR , I don't must use anymore git finish feature, not ? because this last merge, and I need to do PR to pass circle tests.
can I delete my remote branch (because i have a local with the same name)? before do push? that is better? in case of conflicts with the remote?
git
I made a mistake merging my last feature with develop; I had just to finish my feature and then do a PR, and then merge trought github.
What is the right method to go back to before I merge my last feature ?
I'm confused about when do 'git push', and really with a PR , I don't must use anymore git finish feature, not ? because this last merge, and I need to do PR to pass circle tests.
can I delete my remote branch (because i have a local with the same name)? before do push? that is better? in case of conflicts with the remote?
git
git
edited Nov 20 '18 at 10:47
DDave
asked Nov 20 '18 at 10:33
DDaveDDave
390315
390315
1
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
2
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58
add a comment |
1
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
2
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58
1
1
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
2
2
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58
add a comment |
1 Answer
1
active
oldest
votes
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch):
git revert develop -m 2
and thengit push
.
git revert develop -m 2
:git revert
means you're going to create a revert commit, anddevelop
means your revert target is where your develop branch is pointing to, and-m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge.
git reset develop^1 --hard
, and thengit reset origin/develop --mixed
, and thengit commit
(with messages like "Revert merge.")
git reset develop^1 --hard
means you're resettingHEAD
& filesystem status to first parent ofdevelop
. So after this, your filesystem should not include changes fromdevelop
branch.
git reset origin/develop --mixed
means you're resettingHEAD
intoorigin/develop
, but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
add a comment |
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%2f53391057%2frollback-to-develop-branch-without-last-merge-feature%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch):
git revert develop -m 2
and thengit push
.
git revert develop -m 2
:git revert
means you're going to create a revert commit, anddevelop
means your revert target is where your develop branch is pointing to, and-m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge.
git reset develop^1 --hard
, and thengit reset origin/develop --mixed
, and thengit commit
(with messages like "Revert merge.")
git reset develop^1 --hard
means you're resettingHEAD
& filesystem status to first parent ofdevelop
. So after this, your filesystem should not include changes fromdevelop
branch.
git reset origin/develop --mixed
means you're resettingHEAD
intoorigin/develop
, but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
add a comment |
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch):
git revert develop -m 2
and thengit push
.
git revert develop -m 2
:git revert
means you're going to create a revert commit, anddevelop
means your revert target is where your develop branch is pointing to, and-m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge.
git reset develop^1 --hard
, and thengit reset origin/develop --mixed
, and thengit commit
(with messages like "Revert merge.")
git reset develop^1 --hard
means you're resettingHEAD
& filesystem status to first parent ofdevelop
. So after this, your filesystem should not include changes fromdevelop
branch.
git reset origin/develop --mixed
means you're resettingHEAD
intoorigin/develop
, but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
add a comment |
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch):
git revert develop -m 2
and thengit push
.
git revert develop -m 2
:git revert
means you're going to create a revert commit, anddevelop
means your revert target is where your develop branch is pointing to, and-m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge.
git reset develop^1 --hard
, and thengit reset origin/develop --mixed
, and thengit commit
(with messages like "Revert merge.")
git reset develop^1 --hard
means you're resettingHEAD
& filesystem status to first parent ofdevelop
. So after this, your filesystem should not include changes fromdevelop
branch.
git reset origin/develop --mixed
means you're resettingHEAD
intoorigin/develop
, but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch):
git revert develop -m 2
and thengit push
.
git revert develop -m 2
:git revert
means you're going to create a revert commit, anddevelop
means your revert target is where your develop branch is pointing to, and-m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge.
git reset develop^1 --hard
, and thengit reset origin/develop --mixed
, and thengit commit
(with messages like "Revert merge.")
git reset develop^1 --hard
means you're resettingHEAD
& filesystem status to first parent ofdevelop
. So after this, your filesystem should not include changes fromdevelop
branch.
git reset origin/develop --mixed
means you're resettingHEAD
intoorigin/develop
, but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.
answered Nov 20 '18 at 11:04
ik1neik1ne
10016
10016
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
add a comment |
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
thanks but too late, i do a git reset --hard ae350e29e3d9aa194aa51f10befd677f0066f34f , and git push origin $(git_current_branch) -f , and now i've lost i think all the right develop branch, because ae350e29e3d9aa194aa51f10befd677f0066f34f it's a commit that i did not push ! git is really crazy
– DDave
Nov 20 '18 at 11:13
1
1
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
It’s because git doesn’t like removing changes. It’d much rather add additional commits which remove code.
– evolutionxbox
Nov 20 '18 at 11:41
add a comment |
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%2f53391057%2frollback-to-develop-branch-without-last-merge-feature%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
1
From GitHub, go to your PR and scroll down. There should be a "Revert" button. If you are working in collaboration with other users on the develop branch, it's the safer solution.
– Tu.ma
Nov 20 '18 at 10:35
but i had no PR; that is the problem.. I merged it directly, so need rollback to do a PR and not a finish feature that merge without pr
– DDave
Nov 20 '18 at 10:38
stackoverflow.com/questions/7099833/…
– Tu.ma
Nov 20 '18 at 10:41
thanks but? i use gitflow, so my branch is develop; i dont want to do mistakes with master
– DDave
Nov 20 '18 at 10:47
2
You should try and read through the answer. What you have to do is going in the develop branch and revert the commit. The revert will create a new commit that reverts all the changes. Now you have a clean deployment branch, and you can go back to your feature branch.
– Tu.ma
Nov 20 '18 at 10:58