From 95eb88d8ee588d89b4f06d2753ed4d16ab13b39f Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Thu, 4 Aug 2011 16:09:12 +0530 Subject: reset: Make reset remove the sequencer state Years of muscle memory have trained users to use "git reset --hard" to remove the branch state after any sort operation. Make it also remove the sequencer state to facilitate this established workflow: $ git cherry-pick foo..bar ... conflict encountered ... $ git reset --hard # Oops, I didn't mean that $ git cherry-pick quux..bar ... cherry-pick succeeded ... Guard against accidental removal of the sequencer state by providing one level of "undo". In the first "reset" invocation, ".git/sequencer" is moved to ".git/sequencer-old"; it is completely removed only in the second invocation. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- branch.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'branch.c') diff --git a/branch.c b/branch.c index c0c865a4b1..d06aec4637 100644 --- a/branch.c +++ b/branch.c @@ -3,6 +3,7 @@ #include "refs.h" #include "remote.h" #include "commit.h" +#include "sequencer.h" struct tracking { struct refspec spec; @@ -228,4 +229,5 @@ void remove_branch_state(void) unlink(git_path("MERGE_MSG")); unlink(git_path("MERGE_MODE")); unlink(git_path("SQUASH_MSG")); + remove_sequencer_state(0); } -- cgit v1.2.3