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 <artagnon@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
26ae337be1
commit
95eb88d8ee
2
branch.c
2
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user