git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Do git reset --hard HEAD when using git rebase --skip

From
Mike Hommey <mh@glandium.org>
Date
Nov 8, 2007, 07:03 UTC
Message-ID
<1194505386-18156-1-git-send-email-mh@glandium.org>
In-Reply-To
<20071107222105.GA31666@glandium.org>

When you have a merge conflict and want to bypass the commit causing it, you don't want to care about the dirty state of the working tree.

Also, don't git reset --hard HEAD in the rebase-skip test, so that the lack of support for this is detected.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 git-rebase.sh          |    1 +
 t/t3403-rebase-skip.sh |    2 --
 2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index e3ad7de..8814be9 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -158,6 +158,7 @@ do
 		exit
 		;;
 	--skip)
+		git reset --hard HEAD || exit $?
 		if test -d "$dotest"
 		then
 			git rerere clear
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index eab053c..becabfc 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -36,7 +36,6 @@ test_expect_failure 'rebase with git am -3 (default)' '
 '
 
 test_expect_success 'rebase --skip with am -3' '
-	git reset --hard HEAD &&
 	git rebase --skip
 	'
 test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
@@ -44,7 +43,6 @@ test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
 test_expect_failure 'rebase with --merge' 'git rebase --merge master'
 
 test_expect_success 'rebase --skip with --merge' '
-	git reset --hard HEAD &&
 	git rebase --skip
 	'
 
-- 
1.5.3.5
Previous: Johannes Schindelin
Message 20 of 20 in “git rebase --skip”
  1. Mike HommeyNov 7, 2007
  2. Johannes SchindelinNov 7, 2007
  3. Jeff KingNov 8, 2007
  4. Jakub NarebskiNov 8, 2007
  5. Björn SteinbrinkNov 8, 2007
  6. Andreas EricssonNov 8, 2007
  7. Björn SteinbrinkNov 8, 2007
  8. Jeff KingNov 8, 2007
  9. Junio C HamanoNov 8, 2007
  10. Björn SteinbrinkNov 9, 2007
  11. Jeff KingNov 9, 2007
  12. Johannes SchindelinNov 9, 2007
  13. J. Bruce FieldsNov 9, 2007
  14. J. Bruce FieldsNov 9, 2007
  15. Jeff KingNov 9, 2007
  16. Daniel BarkalowNov 8, 2007
  17. Mike HommeyNov 8, 2007
  18. Mike HommeyNov 8, 2007
  19. Johannes SchindelinNov 8, 2007
  20. Do git reset --hard HEAD when using git rebase --skipMike Hommey, Nov 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.