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

[PATCH v3 3/6] rebase -i: add short command-name in --autosquash

From
Liam Beguin <liambeguin@gmail.com>
Date
May 2, 2017, 04:00 UTC
Message-ID
<20170502040048.9065-4-liambeguin@gmail.com>
In-Reply-To
<20170502040048.9065-1-liambeguin@gmail.com>

teach `git rebase -i` to recognise short command-names when using the '--autosquash' option. This allows commit with titles beginning with "s! ..." and "f! ..." to be treated the same way as "squash! ..." and "fixup! ..." respectively.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 Documentation/git-rebase.txt | 2 ++
 git-rebase--interactive.sh   | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 53f4e144444a..3e49d8b046ca 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -437,6 +437,8 @@ without an explicit `--interactive`.
 	commit from `pick` to `squash` (or `fixup`).  Ignores subsequent
 	"fixup! " or "squash! " after the first, in case you referred to an
 	earlier fixup/squash with `git commit --fixup/--squash`.
+	Note that their short counterparts, namely "s! ..." and "f! ..."
+	behave the same way.
 +
 This option is only valid when the `--interactive` option is used.
 +
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4fa621062cdf..61450064c5c4 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -790,7 +790,7 @@ rearrange_squash () {
 	do
 		test -z "${format}" || message=$(git log -n 1 --format="%s" ${sha1})
 		case "$message" in
-		"squash! "*|"fixup! "*)
+		"squash! "*|"s! "*|"fixup! "*|"f! "*)
 			action="${message%%!*}"
 			rest=$message
 			prefix=
@@ -798,7 +798,7 @@ rearrange_squash () {
 			while :
 			do
 				case "$rest" in
-				"squash! "*|"fixup! "*)
+				"squash! "*|"s! "*|"fixup! "*|"f! "*)
 					prefix="$prefix${rest%%!*},"
 					rest="${rest#*! }"
 					;;
-- 
2.9.3
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 21 in “rebase -i: add config to abbreviate command-names”
  1. 0/6 rebase -i: add config to abbreviate command-namesLiam Beguin, May 2, 2017
  2. 1/6 rebase -i: add abbreviated command-names handlingLiam Beguin, May 2, 2017
  3. Johannes SchindelinMay 2, 2017
  4. 2/6 rebase -i: add abbreviate_commands functionLiam Beguin, May 2, 2017
  5. Johannes SchindelinMay 2, 2017
  6. 3/6 rebase -i: add short command-name in --autosquashLiam Beguin, May 2, 2017
  7. Johannes SchindelinMay 2, 2017
  8. Liam BeguinMay 2, 2017
  9. 6/6 Documentation: document the rebase.abbreviateCommands optionLiam Beguin, May 2, 2017
  10. 4/6 Documentation: move rebase.* config variables to a separate rebase-config.txtLiam Beguin, May 2, 2017
  11. Johannes SchindelinMay 2, 2017
  12. 5/6 Documentation: use preferred name for the 'todo list' scriptLiam Beguin, May 2, 2017
  13. Ævar Arnfjörð BjarmasonMay 2, 2017
  14. Johannes SchindelinMay 2, 2017
  15. Johannes SchindelinMay 2, 2017
  16. Liam BeguinMay 2, 2017
  17. Johannes SchindelinMay 3, 2017
  18. Junio C HamanoMay 4, 2017
  19. Liam BeguinMay 7, 2017
  20. Junio C HamanoMay 8, 2017
  21. Liam BeguinMay 8, 2017

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.