{"thread":{"id":"10066","subject":"[PATCH] rebase -i: support single-letter abbreviations for the actions","startedAt":"2007-09-29T01:31:48Z","lastAt":"2007-09-29T23:34:23Z","messageCount":9,"participants":["Johannes Schindelin","Junio C Hamano","Avi Kivity"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"54308","messageId":"Pine.LNX.4.64.0709290231300.28395@racer.site","threadId":"10066","inReplyTo":null,"subject":"[PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-29T01:31:48Z","receivedAt":"2007-09-29T01:31:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen you do many rebases, you can get annoyed by having to type out\nthe actions \"edit\" or \"squash\" in total.\n\nThis commit helps that, by allowing you to enter \"e\" instead of \"edit\",\nor \"s\" instead of \"squash\", and it also plays nice with \"merge\" or \"amend\"\nas synonyms to \"squash\".\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-rebase--interactive.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 823291d..0f9483e 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -232,14 +232,14 @@ do_next () {\n \t'#'*|'')\n \t\tmark_action_done\n \t\t;;\n-\tpick)\n+\tpick|p)\n \t\tcomment_for_reflog pick\n \n \t\tmark_action_done\n \t\tpick_one $sha1 ||\n \t\t\tdie_with_patch $sha1 \"Could not apply $sha1... $rest\"\n \t\t;;\n-\tedit)\n+\tedit|e)\n \t\tcomment_for_reflog edit\n \n \t\tmark_action_done\n@@ -254,7 +254,7 @@ do_next () {\n \t\twarn\n \t\texit 0\n \t\t;;\n-\tsquash)\n+\tsquash|s|merge|m|amend|a)\n \t\tcomment_for_reflog squash\n \n \t\thas_action \"$DONE\" ||\n@@ -263,7 +263,7 @@ do_next () {\n \t\tmark_action_done\n \t\tmake_squash_message $sha1 > \"$MSG\"\n \t\tcase \"$(peek_next_command)\" in\n-\t\tsquash)\n+\t\tsquash|s|merge|m|amend|a)\n \t\t\tEDIT_COMMIT=\n \t\t\tUSE_OUTPUT=output\n \t\t\tcp \"$MSG\" \"$SQUASH_MSG\"\n-- \n1.5.3.2.1102.g9487\n"},{"id":"54309","messageId":"7vfy0ymd7g.fsf@gitster.siamese.dyndns.org","threadId":"10066","inReplyTo":"Pine.LNX.4.64.0709290231300.28395@racer.site","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-29T02:12:51Z","receivedAt":"2007-09-29T02:12:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> When you do many rebases, you can get annoyed by having to type out\n> the actions \"edit\" or \"squash\" in total.\n>\n> This commit helps that, by allowing you to enter \"e\" instead of \"edit\",\n> or \"s\" instead of \"squash\", and it also plays nice with \"merge\" or \"amend\"\n> as synonyms to \"squash\".\n\nI am not sure if we want to taint the words merge and amend like\nthis.  I was hoping someday you would allow people to reorder\nsomething like this...\n\n          e\n           \\     \n ---a---b---c---d\n\ninto something like this:\n\n      e\n       \\     \n ---b'--c'--a'+d'\n\nThe insn sequence you prepare for the user to edit would be:\n\n\tpick\ta\t\n\tpick\tb\n\tmerge   c\n        pick    d\n\nand then the user would rewrite that to:\n\n\tpick\tb\n        merge   c\n        pick    a\n        squash  d\n\nI do not think making 'amend' a synonym to 'squash' is correct\neither; isn't it closer to 'edit'?\n\nI however do agree that giving short-hand would be a good idea.\n \n"},{"id":"54310","messageId":"Pine.LNX.4.64.0709290323560.28395@racer.site","threadId":"10066","inReplyTo":"7vfy0ymd7g.fsf@gitster.siamese.dyndns.org","subject":"[PATCH v2] rebase -i: support single-letter abbreviations for the actions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-29T02:32:11Z","receivedAt":"2007-09-29T02:32:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen you do many rebases, you can get annoyed by having to type out\nthe actions \"edit\" or \"squash\" in total.\n\nThis commit helps that, by allowing you to enter \"e\" instead of \"edit\",\n\"p\" instead of \"pick\", or \"s\" instead of \"squash\".\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Fri, 28 Sep 2007, Junio C Hamano wrote:\n\n\t> I am not sure if we want to taint the words merge and amend like\n\t> this.  I was hoping someday you would allow people to reorder\n\t> something like this...\n\n\tOkay, you convinced me.\n\n\t> \n\t>           e\n\t>            \\     \n\t>  ---a---b---c---d\n\t> \n\t> into something like this:\n\t> \n\t>       e\n\t>        \\     \n\t>  ---b'--c'--a'+d'\n\n\tI thought that this would be possible with \"git rebase -p -i\"?\n\n\tAh no, that does not work; \"-p\" is not yet graceful enough to \n\taccept reorders.  (But then, I do not see why the command should \n\tbe \"merge\" instead of the \"pick\" we already have...)\n\n git-rebase--interactive.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 823291d..7a5aaa5 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -232,14 +232,14 @@ do_next () {\n \t'#'*|'')\n \t\tmark_action_done\n \t\t;;\n-\tpick)\n+\tpick|p)\n \t\tcomment_for_reflog pick\n \n \t\tmark_action_done\n \t\tpick_one $sha1 ||\n \t\t\tdie_with_patch $sha1 \"Could not apply $sha1... $rest\"\n \t\t;;\n-\tedit)\n+\tedit|e)\n \t\tcomment_for_reflog edit\n \n \t\tmark_action_done\n@@ -254,7 +254,7 @@ do_next () {\n \t\twarn\n \t\texit 0\n \t\t;;\n-\tsquash)\n+\tsquash|s)\n \t\tcomment_for_reflog squash\n \n \t\thas_action \"$DONE\" ||\n@@ -263,7 +263,7 @@ do_next () {\n \t\tmark_action_done\n \t\tmake_squash_message $sha1 > \"$MSG\"\n \t\tcase \"$(peek_next_command)\" in\n-\t\tsquash)\n+\t\tsquash|s)\n \t\t\tEDIT_COMMIT=\n \t\t\tUSE_OUTPUT=output\n \t\t\tcp \"$MSG\" \"$SQUASH_MSG\"\n-- \n1.5.3.2.1102.g9487\n"},{"id":"54347","messageId":"46FE7D0B.4060806@qumranet.com","threadId":"10066","inReplyTo":"Pine.LNX.4.64.0709290231300.28395@racer.site","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Avi Kivity","fromEmail":"avi@qumranet.com","sentAt":"2007-09-29T16:27:55Z","receivedAt":"2007-09-29T16:27:55Z","isPatch":true,"sender":{"key":"avi@qumranet.com","avatar":null},"body":"Johannes Schindelin wrote:\n> When you do many rebases, you can get annoyed by having to type out\n> the actions \"edit\" or \"squash\" in total.\n>\n> This commit helps that, by allowing you to enter \"e\" instead of \"edit\",\n> or \"s\" instead of \"squash\", and it also plays nice with \"merge\" or \"amend\"\n> as synonyms to \"squash\".\n>\n>   \n\nCan we make \"amend\" like squash, except that it keeps the first commit's \nauthorship instead of the second?  I often merge a commit with some \nminor fix that comes later, and usually want to keep the original author \nrecord.\n\n-- \nAny sufficiently difficult bug is indistinguishable from a feature.\n"},{"id":"54359","messageId":"Pine.LNX.4.64.0709292156090.28395@racer.site","threadId":"10066","inReplyTo":"46FE7D0B.4060806@qumranet.com","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-29T20:58:09Z","receivedAt":"2007-09-29T20:58:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 29 Sep 2007, Avi Kivity wrote:\n\n> Johannes Schindelin wrote:\n> > When you do many rebases, you can get annoyed by having to type out \n> > the actions \"edit\" or \"squash\" in total.\n> > \n> > This commit helps that, by allowing you to enter \"e\" instead of \n> > \"edit\", or \"s\" instead of \"squash\", and it also plays nice with \n> > \"merge\" or \"amend\" as synonyms to \"squash\".\n> \n> Can we make \"amend\" like squash, except that it keeps the first commit's \n> authorship instead of the second?  I often merge a commit with some \n> minor fix that comes later, and usually want to keep the original author \n> record.\n\nI do not necessarily think it is not doable, but I have different \nsuggestion to you:\n\nIf you amend the commit with a minor fix that comes later, why not do \n\"rebase -i\" _before_ applying the fix, and then using \"edit\" on the \nrespective commit?\n\nThat way you can even test the result easily, which you cannot do with \n\"squash\".\n\nCiao,\nDscho\n"},{"id":"54362","messageId":"46FEC00B.7050208@qumranet.com","threadId":"10066","inReplyTo":"Pine.LNX.4.64.0709292156090.28395@racer.site","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Avi Kivity","fromEmail":"avi@qumranet.com","sentAt":"2007-09-29T21:13:47Z","receivedAt":"2007-09-29T21:13:47Z","isPatch":true,"sender":{"key":"avi@qumranet.com","avatar":null},"body":"Johannes Schindelin wrote:\n> Hi,\n>\n> On Sat, 29 Sep 2007, Avi Kivity wrote:\n>\n>   \n>> Johannes Schindelin wrote:\n>>     \n>>> When you do many rebases, you can get annoyed by having to type out \n>>> the actions \"edit\" or \"squash\" in total.\n>>>\n>>> This commit helps that, by allowing you to enter \"e\" instead of \n>>> \"edit\", or \"s\" instead of \"squash\", and it also plays nice with \n>>> \"merge\" or \"amend\" as synonyms to \"squash\".\n>>>       \n>> Can we make \"amend\" like squash, except that it keeps the first commit's \n>> authorship instead of the second?  I often merge a commit with some \n>> minor fix that comes later, and usually want to keep the original author \n>> record.\n>>     \n>\n> I do not necessarily think it is not doable, but I have different \n> suggestion to you:\n>\n> If you amend the commit with a minor fix that comes later, why not do \n> \"rebase -i\" _before_ applying the fix, and then using \"edit\" on the \n> respective commit?\n>   \n\nThis is what I do now.  Edit the commit, cherry-pick -n, and commit \n--amend.  But it's less pleasant than using the rebase --interactive \ninterface.\n\n[This is part of the workflow to prepare a patchset for submitting \nupstream; I don't edit commits on my master branch]\n\n> That way you can even test the result easily, which you cannot do with \n> \"squash\".\n>   \n\nUsually these are trivial fixes, and have already been tested by being \nincluded in my main branch.\n\n-- \nAny sufficiently difficult bug is indistinguishable from a feature.\n"},{"id":"54365","messageId":"Pine.LNX.4.64.0709292243280.28395@racer.site","threadId":"10066","inReplyTo":"46FEC00B.7050208@qumranet.com","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-29T21:48:00Z","receivedAt":"2007-09-29T21:48:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 29 Sep 2007, Avi Kivity wrote:\n\n> > > Can we make \"amend\" like squash, except that it keeps the first \n> > > commit's authorship instead of the second?  I often merge a commit \n> > > with some minor fix that comes later, and usually want to keep the \n> > > original author record.\n\nThinking about this again... Maybe it is a better semantics anyway? What \ndo others think?\n\nCiao,\nDscho\n"},{"id":"54368","messageId":"7vzlz5jfa1.fsf@gitster.siamese.dyndns.org","threadId":"10066","inReplyTo":"Pine.LNX.4.64.0709292243280.28395@racer.site","subject":"Re: [PATCH] rebase -i: support single-letter abbreviations for the actions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-29T22:08:38Z","receivedAt":"2007-09-29T22:08:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Sat, 29 Sep 2007, Avi Kivity wrote:\n>\n>> > > Can we make \"amend\" like squash, except that it keeps the first \n>> > > commit's authorship instead of the second?  I often merge a commit \n>> > > with some minor fix that comes later, and usually want to keep the \n>> > > original author record.\n>\n> Thinking about this again... Maybe it is a better semantics anyway? What \n> do others think?\n\nI never thought about whose commit the squashed ones become\nbefore this thread, but making squash quack as if \"commit\n--amend\" was done after running \"cherry-pick -n\" the second and\nlater ones feels like the most natural semantics to me.\n"},{"id":"54380","messageId":"Pine.LNX.4.64.0709300032520.28395@racer.site","threadId":"10066","inReplyTo":"7vzlz5jfa1.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] rebase -i: squash should retain the authorship of the _first_ commit","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-29T23:34:23Z","receivedAt":"2007-09-29T23:34:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIt was determined on the mailing list, that it makes more sense for a \n\"squash\" to keep the author of the first commit as the author for the \nresult of the squash.\n\nMake it so.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Sat, 29 Sep 2007, Junio C Hamano wrote:\n\n\t> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\t> \n\t> > On Sat, 29 Sep 2007, Avi Kivity wrote:\n\t> >\n\t> >> > > Can we make \"amend\" like squash, except that it keeps the \n\t> >> > > first commit's authorship instead of the second?  I often \n\t> >> > > merge a commit with some minor fix that comes later, and \n\t> >> > > usually want to keep the original author record.\n\t> >\n\t> > Thinking about this again... Maybe it is a better semantics \n\t> > anyway? What do others think?\n\t> \n\t> I never thought about whose commit the squashed ones become\n\t> before this thread, but making squash quack as if \"commit\n\t> --amend\" was done after running \"cherry-pick -n\" the second and\n\t> later ones feels like the most natural semantics to me.\n\n\tHere you are.\n\n Documentation/git-rebase.txt  |    2 +-\n git-rebase--interactive.sh    |    2 +-\n t/t3404-rebase-interactive.sh |    2 +-\n 3 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 0858fa8..e8e7579 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -298,7 +298,7 @@ rebasing.\n If you want to fold two or more commits into one, replace the command\n \"pick\" with \"squash\" for the second and subsequent commit.  If the\n commits had different authors, it will attribute the squashed commit to\n-the author of the last commit.\n+the author of the first commit.\n \n In both cases, or when a \"pick\" does not succeed (because of merge\n errors), the loop will stop to let you fix things, and you can continue\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 7a5aaa5..050140d 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -276,9 +276,9 @@ do_next () {\n \t\tesac\n \n \t\tfailed=f\n+\t\tauthor_script=$(get_author_ident_from_commit HEAD)\n \t\toutput git reset --soft HEAD^\n \t\tpick_one -n $sha1 || failed=t\n-\t\tauthor_script=$(get_author_ident_from_commit $sha1)\n \t\techo \"$author_script\" > \"$DOTEST\"/author-script\n \t\tcase $failed in\n \t\tf)\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex f2214dd..1113904 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -180,7 +180,7 @@ test_expect_success 'squash' '\n '\n \n test_expect_success 'retain authorship when squashing' '\n-\tgit show HEAD | grep \"^Author: Nitfol\"\n+\tgit show HEAD | grep \"^Author: Twerp Snog\"\n '\n \n test_expect_success 'preserve merges with -p' '\n-- \n1.5.3.2.1102.g9487\n"}]}