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

[PATCH] bisect reset: Leave the tree in usable state if git-checkout failed

From
Petr Baudis <pasky@suse.cz>
Date
Oct 16, 2006, 00:59 UTC
Message-ID
<20061016005925.27019.38262.stgit@machine.or.cz>

I had local modifications in the tree and doing bisect reset required me to manually edit .git/HEAD.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 git-bisect.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index 06a8d26..09cd179 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -179,11 +179,12 @@ bisect_reset() {
         *)
 	    usage ;;
 	esac
-	git checkout "$branch" &&
-	rm -fr "$GIT_DIR/refs/bisect"
-	rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
-	rm -f "$GIT_DIR/BISECT_LOG"
-	rm -f "$GIT_DIR/BISECT_NAMES"
+	if ! git checkout "$branch"; then
+		rm -fr "$GIT_DIR/refs/bisect"
+		rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
+		rm -f "$GIT_DIR/BISECT_LOG"
+		rm -f "$GIT_DIR/BISECT_NAMES"
+	fi
 }
 
 bisect_replay () {
Next: Petr Baudis
Message 1 of 2 in “bisect reset: Leave the tree in usable state if git-checkout failed”
  1. bisect reset: Leave the tree in usable state if git-checkout failedPetr Baudis, Oct 16, 2006
  2. Petr BaudisOct 16, 2006

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.