From 9408a0a07008f1658089d4a378966364b9767d30 Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:21 -0500 Subject: [PATCH] Added reset-branch command. --- git-repl.cl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/git-repl.cl b/git-repl.cl index 65e8d20..0574ce2 100644 --- a/git-repl.cl +++ b/git-repl.cl @@ -187,6 +187,20 @@ (git "checkout" revision)) (git "checkout" revision))) +(defun-public reset-branch (revision &key (mode 'mixed) (without-config nil)) + "Performs a reset to the specified revision. + The :mode must be either 'soft, 'mixed (default), or 'hard. + If :without-config is set to T (default is NIL), stashes your configuration before the checkout and pops the stash afterwards." + (let ((mode-string (cond + ((eq mode 'soft) "--soft") + ((eq mode 'mixed) "--mixed") + ((eq mode 'hard) "--hard") + (t (error "Mode must be either 'soft, 'mixed, or 'hard"))))) + (if without-config + (without-config-do + (git "reset" mode-string revision)) + (git "reset" mode-string revision)))) + (defun-public mergetool () "Executes the mergetool configured with git" (git "mergetool")) -- 2.20.1