diff mbox series

rebase-interactive: show revert option and add single letter shortcut

Message ID 20231218152313.72896-1-mi.al.lohmann@gmail.com (mailing list archive)
State Superseded
Headers show
Series rebase-interactive: show revert option and add single letter shortcut | expand

Commit Message

Michael Lohmann Dec. 18, 2023, 3:23 p.m. UTC
Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
---
 Documentation/git-rebase.txt | 3 +++
 rebase-interactive.c         | 1 +
 sequencer.c                  | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

Comments

Phillip Wood Dec. 18, 2023, 4:32 p.m. UTC | #1
Hi Michael

Thanks for the patch, I'm wondering why you want to revert a commit when 
you're rebasing. I think it would be helpful to explain that in the 
commit message. In particular why it is necessary to revert a commit 
rather than simply dropping it (presumably you're using rebase to do 
something more that just rework a series of commits)

Best Wishes

Phillip

On 18/12/2023 15:23, Michael Lohmann wrote:
> Signed-off-by: Michael Lohmann <mi.al.lohmann@gmail.com>
> ---
>   Documentation/git-rebase.txt | 3 +++
>   rebase-interactive.c         | 1 +
>   sequencer.c                  | 2 +-
>   3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 1dd6555f66..75f6fe39a1 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -911,6 +911,9 @@ commit, the message from the final one is used.  You can also use
>   "fixup -C" to get the same behavior as "fixup -c" except without opening
>   an editor.
>   
> +To revert a commit, add a line starting with "revert" followed by the commit
> +name.
> +
>   `git rebase` will stop when "pick" has been replaced with "edit" or
>   when a command fails due to merge errors. When you are done editing
>   and/or resolving conflicts you can continue with `git rebase --continue`.
> diff --git a/rebase-interactive.c b/rebase-interactive.c
> index d9718409b3..e1fd1e09e3 100644
> --- a/rebase-interactive.c
> +++ b/rebase-interactive.c
> @@ -53,6 +53,7 @@ void append_todo_help(int command_count,
>   "                   commit's log message, unless -C is used, in which case\n"
>   "                   keep only this commit's message; -c is same as -C but\n"
>   "                   opens the editor\n"
> +"v, revert <commit> = revert the changes introduced by that commit\n"
>   "x, exec <command> = run command (the rest of the line) using shell\n"
>   "b, break = stop here (continue rebase later with 'git rebase --continue')\n"
>   "d, drop <commit> = remove commit\n"
> diff --git a/sequencer.c b/sequencer.c
> index d584cac8ed..3c18f71ed6 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1767,7 +1767,7 @@ static struct {
>   	const char *str;
>   } todo_command_info[] = {
>   	[TODO_PICK] = { 'p', "pick" },
> -	[TODO_REVERT] = { 0,   "revert" },
> +	[TODO_REVERT] = { 'v', "revert" },
>   	[TODO_EDIT] = { 'e', "edit" },
>   	[TODO_REWORD] = { 'r', "reword" },
>   	[TODO_FIXUP] = { 'f', "fixup" },
diff mbox series

Patch

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 1dd6555f66..75f6fe39a1 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -911,6 +911,9 @@  commit, the message from the final one is used.  You can also use
 "fixup -C" to get the same behavior as "fixup -c" except without opening
 an editor.
 
+To revert a commit, add a line starting with "revert" followed by the commit
+name.
+
 `git rebase` will stop when "pick" has been replaced with "edit" or
 when a command fails due to merge errors. When you are done editing
 and/or resolving conflicts you can continue with `git rebase --continue`.
diff --git a/rebase-interactive.c b/rebase-interactive.c
index d9718409b3..e1fd1e09e3 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -53,6 +53,7 @@  void append_todo_help(int command_count,
 "                   commit's log message, unless -C is used, in which case\n"
 "                   keep only this commit's message; -c is same as -C but\n"
 "                   opens the editor\n"
+"v, revert <commit> = revert the changes introduced by that commit\n"
 "x, exec <command> = run command (the rest of the line) using shell\n"
 "b, break = stop here (continue rebase later with 'git rebase --continue')\n"
 "d, drop <commit> = remove commit\n"
diff --git a/sequencer.c b/sequencer.c
index d584cac8ed..3c18f71ed6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1767,7 +1767,7 @@  static struct {
 	const char *str;
 } todo_command_info[] = {
 	[TODO_PICK] = { 'p', "pick" },
-	[TODO_REVERT] = { 0,   "revert" },
+	[TODO_REVERT] = { 'v', "revert" },
 	[TODO_EDIT] = { 'e', "edit" },
 	[TODO_REWORD] = { 'r', "reword" },
 	[TODO_FIXUP] = { 'f', "fixup" },