From 2b34d204851f2c17ddeddc8af2739714888881c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Petit?= Date: Wed, 21 Dec 2016 17:42:00 +0100 Subject: [PATCH 1/3] ADD undo rebase/merge Please correct my broken english :) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index f838d5cc..09319be7 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ For clarity's sake all examples in this document use a customized bash prompt in - [I accidentally deleted my branch](#i-accidentally-deleted-my-branch) - [I want to delete a branch](#i-want-to-delete-a-branch) - [Rebasing and Merging](#rebasing-and-merging) + - [I want to undo rebase/merge](#undo-rebase) - [I rebased, but I don't want to force push.](#i-rebased-but-i-dont-want-to-force-push) - [I need to combine commits](#i-need-to-combine-commits) - [Safe merging strategy](#safe-merging-strategy) @@ -561,6 +562,15 @@ To delete a local branch: ## Rebasing and Merging + +### I want to undo rebase/merge + +You may have merge/rebase your current branch with a wrong branch, or you simply cannot manage to achieve a correct result or even finish the rebase/merge process. Git is saving the original HEAD pointer in ORIG_HEAD, so it is simple to recover you're branch at the state before the rebase/merge. + +```sh +(my-branch)$ git reset --hard ORIG_HEAD +``` + ### I rebased, but I don't want to force push. From 9478da7964adc7a902cc5ceb3c1071c07929153d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Petit?= Date: Wed, 21 Dec 2016 17:43:59 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09319be7..1a5386e1 100644 --- a/README.md +++ b/README.md @@ -565,7 +565,7 @@ To delete a local branch: ### I want to undo rebase/merge -You may have merge/rebase your current branch with a wrong branch, or you simply cannot manage to achieve a correct result or even finish the rebase/merge process. Git is saving the original HEAD pointer in ORIG_HEAD, so it is simple to recover you're branch at the state before the rebase/merge. +You may have merge/rebase your current branch with a wrong branch, or you simply cannot manage to achieve a correct result or even finish the rebase/merge process. Git is saving the original HEAD pointer in ORIG_HEAD, so it is simple to recover your branch at the state before the rebase/merge. ```sh (my-branch)$ git reset --hard ORIG_HEAD From 5bad85aeba858a53333d1ccdd5c1b8531f0fa09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Petit?= Date: Sun, 8 Jan 2017 00:32:15 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a5386e1..c6fcc8d4 100644 --- a/README.md +++ b/README.md @@ -565,7 +565,7 @@ To delete a local branch: ### I want to undo rebase/merge -You may have merge/rebase your current branch with a wrong branch, or you simply cannot manage to achieve a correct result or even finish the rebase/merge process. Git is saving the original HEAD pointer in ORIG_HEAD, so it is simple to recover your branch at the state before the rebase/merge. +You may have merged or rebased your current branch with a wrong branch, or you can't figure it out or finish the rebase/merge process. Git saves the original HEAD pointer in a variable called ORIG_HEAD before doing dangerous operations, so it is simple to recover your branch at the state before the rebase/merge. ```sh (my-branch)$ git reset --hard ORIG_HEAD