{"thread":{"id":"31020","subject":"Support of '^' as alias for 'HEAD^'","startedAt":"2012-07-14T00:39:12Z","lastAt":"2012-07-15T21:48:09Z","messageCount":10,"participants":["Zeeshan Ali (Khattak)","Stefan Näwe","Junio C Hamano","Jeff King","Holger Hellmuth"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"195035","messageId":"CAAa3hFMgy66W0dVEGv164Zowfa6Q-5DqgkkLz_1paymU_1SHUw@mail.gmail.com","threadId":"31020","inReplyTo":null,"subject":"Support of '^' as alias for 'HEAD^'","fromName":"Zeeshan Ali (Khattak)","fromEmail":"zeeshanak@gnome.org","sentAt":"2012-07-14T00:39:12Z","receivedAt":"2012-07-14T00:39:12Z","isPatch":false,"sender":{"key":"zeeshanak@gnome.org","avatar":null},"body":"Hi,\n  Many times I want to refer to 'HEAD^', 'HEAD^^' and sometimes even\nfurther up the tree. It would be really nice if I didn't have to type\n'HEAD^' but could only type '^'. Bash completion make things easier\nbut it automatically inserts a space immediately after HEAD so you\nhave to hit backspace. I think this change would be good in general\nanyway.\n\n-- \nRegards,\n\nZeeshan Ali (Khattak)\nFSF member#5124\n"},{"id":"195041","messageId":"loom.20120714T114718-783@post.gmane.org","threadId":"31020","inReplyTo":"CAAa3hFMgy66W0dVEGv164Zowfa6Q-5DqgkkLz_1paymU_1SHUw@mail.gmail.com","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Stefan Näwe","fromEmail":"stefan.naewe@gmail.com","sentAt":"2012-07-14T09:48:31Z","receivedAt":"2012-07-14T09:48:31Z","isPatch":false,"sender":{"key":"stefan.naewe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/4468?v=4"},"body":"Zeeshan Ali (Khattak <zeeshanak <at> gnome.org> writes:\n\n> \n> Hi,\n>   Many times I want to refer to 'HEAD^', 'HEAD^^' and sometimes even\n> further up the tree. It would be really nice if I didn't have to type\n> 'HEAD^' but could only type '^'. Bash completion make things easier\n> but it automatically inserts a space immediately after HEAD so you\n> have to hit backspace. I think this change would be good in general\n> anyway.\n\nOr even '~1', '~3'.\n\nWhere's the '+1' button...?\n\nStefan\n"},{"id":"195056","messageId":"7vzk725c86.fsf@alter.siamese.dyndns.org","threadId":"31020","inReplyTo":"loom.20120714T114718-783@post.gmane.org","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-14T20:17:29Z","receivedAt":"2012-07-14T20:17:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Näwe <stefan.naewe@gmail.com> writes:\n\n> Zeeshan Ali (Khattak <zeeshanak <at> gnome.org> writes:\n>> \n>> Many times I want to refer to 'HEAD^', 'HEAD^^' and sometimes even\n>> further up the tree. It would be really nice if I didn't have to type\n>> 'HEAD^' but could only type '^'. Bash completion make things easier\n>> but it automatically inserts a space immediately after HEAD so you\n>> have to hit backspace. I think this change would be good in general\n>> anyway.\n>\n> Or even '~1', '~3'.\n\n\"^\" has a problem when used with other things (does \"log ^^2\norigin\" mean \"log HEAD^2..origin\"?  Or \"log HEAD^^2 origin\"), so I\ndo not think it would never fly as an abbreviated syntax.\n\nWhile I see your \"~<N>\" much distasteful compared to \"^\", you still\nneed to be a bit more careful when analysing the benefit of such an\nabbreviation.  To shells used by many people, these mean tilde\nexpansion ~<N> to refer to elements on the dirstack and you need to\nquote, perhaps like \\~3.\n"},{"id":"195058","messageId":"7vr4se5bg4.fsf@alter.siamese.dyndns.org","threadId":"31020","inReplyTo":"7vzk725c86.fsf@alter.siamese.dyndns.org","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-14T20:34:19Z","receivedAt":"2012-07-14T20:34:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Stefan Näwe <stefan.naewe@gmail.com> writes:\n>\n>> Zeeshan Ali (Khattak <zeeshanak <at> gnome.org> writes:\n>>> \n>>> Many times I want to refer to 'HEAD^', 'HEAD^^' and sometimes even\n>>> further up the tree. It would be really nice if I didn't have to type\n>>> 'HEAD^' but could only type '^'. Bash completion make things easier\n>>> but it automatically inserts a space immediately after HEAD so you\n>>> have to hit backspace. I think this change would be good in general\n>>> anyway.\n>>\n>> Or even '~1', '~3'.\n>\n> \"^\" has a problem when used with other things (does \"log ^^2\n> origin\" mean \"log HEAD^2..origin\"?  Or \"log HEAD^^2 origin\"), so I\n> do not think it would never fly as an abbreviated syntax.\n>\n> While I see your \"~<N>\" much distasteful compared to \"^\", you still\n\ns/dist/less dist/; sorry ;-)\n\n> need to be a bit more careful when analysing the benefit of such an\n> abbreviation.  To shells used by many people, these mean tilde\n> expansion ~<N> to refer to elements on the dirstack and you need to\n> quote, perhaps like \\~3.\n"},{"id":"195059","messageId":"CAAa3hFOv39DhuEDTyJUm1pzB-X1gBiV8FXuqW6TidOtQw9CUng@mail.gmail.com","threadId":"31020","inReplyTo":"7vr4se5bg4.fsf@alter.siamese.dyndns.org","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Zeeshan Ali (Khattak)","fromEmail":"zeeshanak@gnome.org","sentAt":"2012-07-14T20:49:11Z","receivedAt":"2012-07-14T20:49:11Z","isPatch":false,"sender":{"key":"zeeshanak@gnome.org","avatar":null},"body":"On Sat, Jul 14, 2012 at 11:34 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Stefan Näwe <stefan.naewe@gmail.com> writes:\n>>\n>>> Zeeshan Ali (Khattak <zeeshanak <at> gnome.org> writes:\n>>>>\n>>>> Many times I want to refer to 'HEAD^', 'HEAD^^' and sometimes even\n>>>> further up the tree. It would be really nice if I didn't have to type\n>>>> 'HEAD^' but could only type '^'. Bash completion make things easier\n>>>> but it automatically inserts a space immediately after HEAD so you\n>>>> have to hit backspace. I think this change would be good in general\n>>>> anyway.\n>>>\n>>> Or even '~1', '~3'.\n>>\n>> \"^\" has a problem when used with other things (does \"log ^^2\n>> origin\" mean \"log HEAD^2..origin\"?  Or \"log HEAD^^2 origin\"), so I\n>> do not think it would never fly as an abbreviated syntax.\n\nWhat about '^' and '^^' that I suggested?\n\n>> While I see your \"~<N>\" much distasteful compared to \"^\", you still\n>\n> s/dist/less dist/; sorry ;-)\n\nWhy?\n\n>> need to be a bit more careful when analysing the benefit of such an\n>> abbreviation.  To shells used by many people, these mean tilde\n>> expansion ~<N> to refer to elements on the dirstack and you need to\n>> quote, perhaps like \\~3.\n\nThat would kinda beat the purpose I think, would be nice to just type\n1 key rather than 3 to refer to HEAD (2 keys would still be good\nenough IMHO).\n\n-- \nRegards,\n\nZeeshan Ali (Khattak)\nFSF member#5124\n"},{"id":"195062","messageId":"7vmx32590u.fsf@alter.siamese.dyndns.org","threadId":"31020","inReplyTo":"CAAa3hFOv39DhuEDTyJUm1pzB-X1gBiV8FXuqW6TidOtQw9CUng@mail.gmail.com","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-14T21:26:41Z","receivedAt":"2012-07-14T21:26:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Zeeshan Ali (Khattak)\" <zeeshanak@gnome.org> writes:\n\n> What about '^' and '^^' that I suggested?\n>\n>>> While I see your \"~<N>\" much distasteful compared to \"^\", you still\n>>\n>> s/dist/less dist/; sorry ;-)\n>\n> Why?\n\nThat \"^^\" is the most important reason why your \"^ is the same as\nHEAD^\" is flawed, and goes against my taste.\n\nThink what \"log ^^ origin\" would mean.  Is it \"log ^HEAD^ origin\"?\nIs it \"log HEAD^^ origin\"?  They mean totally different things.\n\nCompared to that, at least ~<n> does not have such ambiguity within\nthe context of Git (having to quote is an ambiguity within the\ncontext of using Git with shells that support dirstacks in their\ntilde expansion).\n"},{"id":"195065","messageId":"CAAa3hFMNf_wA22ngypSu379jr31r3L3yAjTkvDUd_L-mVwPJkA@mail.gmail.com","threadId":"31020","inReplyTo":"7vmx32590u.fsf@alter.siamese.dyndns.org","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Zeeshan Ali (Khattak)","fromEmail":"zeeshanak@gnome.org","sentAt":"2012-07-14T22:24:18Z","receivedAt":"2012-07-14T22:24:18Z","isPatch":false,"sender":{"key":"zeeshanak@gnome.org","avatar":null},"body":"On Sun, Jul 15, 2012 at 12:26 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Zeeshan Ali (Khattak)\" <zeeshanak@gnome.org> writes:\n>\n>> What about '^' and '^^' that I suggested?\n>>\n>>>> While I see your \"~<N>\" much distasteful compared to \"^\", you still\n>>>\n>>> s/dist/less dist/; sorry ;-)\n>>\n>> Why?\n>\n> That \"^^\" is the most important reason why your \"^ is the same as\n> HEAD^\" is flawed, and goes against my taste.\n>\n> Think what \"log ^^ origin\" would mean.  Is it \"log ^HEAD^ origin\"?\n> Is it \"log HEAD^^ origin\"?  They mean totally different things.\n\nSorry for my ignorance here but what does ^ *before* HEAD even mean? I\ntried playing with different combinations of ^ and HEAD here (e.g\n^HEAD^, ^HEAD^^, ^HEAD^^^) with both log and show commands but git\njust silently returns on them. Is this ^ before HEAD actually used\ncause I have never seen/heard of that before. Google isn't able to\nhelp either.\n\n> Compared to that, at least ~<n> does not have such ambiguity within\n> the context of Git (having to quote is an ambiguity within the\n> context of using Git with shells that support dirstacks in their\n> tilde expansion).\n\nDon't know whats dirstacks support either but that I guess just means\nthat bash (the shell I have always used) doesn't do that.\n\n-- \nRegards,\n\nZeeshan Ali (Khattak)\nFSF member#5124\n"},{"id":"195075","messageId":"20120715074441.GA18385@sigill.intra.peff.net","threadId":"31020","inReplyTo":"CAAa3hFMNf_wA22ngypSu379jr31r3L3yAjTkvDUd_L-mVwPJkA@mail.gmail.com","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-07-15T07:44:42Z","receivedAt":"2012-07-15T07:44:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jul 15, 2012 at 01:24:18AM +0300, Zeeshan Ali (Khattak) wrote:\n\n> > Think what \"log ^^ origin\" would mean.  Is it \"log ^HEAD^ origin\"?\n> > Is it \"log HEAD^^ origin\"?  They mean totally different things.\n> \n> Sorry for my ignorance here but what does ^ *before* HEAD even mean? I\n\nIt means \"not\" (before \"HEAD\" or any other commit specifier). See\n\"Specifying Ranges\" in \"git help revisions\".\n\n> > Compared to that, at least ~<n> does not have such ambiguity within\n> > the context of Git (having to quote is an ambiguity within the\n> > context of using Git with shells that support dirstacks in their\n> > tilde expansion).\n> \n> Don't know whats dirstacks support either but that I guess just means\n> that bash (the shell I have always used) doesn't do that.\n\nBash does support them, but you may not use them personally. Here are\nsome examples of how a more bare \"~\" can go wrong:\n\n  $ set -x\n  [this instructs the shell to show us what it is executing]\n\n  $ git log ~\n  + git log /home/peff\n  [oops, the shell expanded our home directory and passed it to git]\n\n  $ git log ~1\n  + git log '~1'\n  [this one works ok, but...]\n\n  $ pushd /tmp\n  $ pushd $HOME\n  $ git log ~1\n  + git log /tmp\n  [oops, pushd users cannot use ~<n> without quoting]\n\n-Peff\n"},{"id":"195084","messageId":"500301BF.9080505@ira.uka.de","threadId":"31020","inReplyTo":"CAAa3hFMNf_wA22ngypSu379jr31r3L3yAjTkvDUd_L-mVwPJkA@mail.gmail.com","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-07-15T17:45:35Z","receivedAt":"2012-07-15T17:45:35Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"Am 15.07.2012 00:24, schrieb Zeeshan Ali (Khattak):\n> On Sun, Jul 15, 2012 at 12:26 AM, Junio C Hamano<gitster@pobox.com>  wrote:\n>> \"Zeeshan Ali (Khattak)\"<zeeshanak@gnome.org>  writes:\n>>\n>>> What about '^' and '^^' that I suggested?\n\nIf you want a shortcut, you might try this:\n\necho \"ref: HEAD\" > .git/h\n\nThen you can use 'h' instead of 'HEAD'.\n\nTested it and it seemed to work. If not someone on this list surely will \ncorrect me.\n"},{"id":"195089","messageId":"CAAa3hFOEtx7d8QzCyBLJEw7kjEb0oPaT=EnFiY3DdApnkHt+hg@mail.gmail.com","threadId":"31020","inReplyTo":"500301BF.9080505@ira.uka.de","subject":"Re: Support of '^' as alias for 'HEAD^'","fromName":"Zeeshan Ali (Khattak)","fromEmail":"zeeshanak@gnome.org","sentAt":"2012-07-15T21:48:09Z","receivedAt":"2012-07-15T21:48:09Z","isPatch":false,"sender":{"key":"zeeshanak@gnome.org","avatar":null},"body":"On Sun, Jul 15, 2012 at 8:45 PM, Holger Hellmuth <hellmuth@ira.uka.de> wrote:\n> Am 15.07.2012 00:24, schrieb Zeeshan Ali (Khattak):\n>\n>> On Sun, Jul 15, 2012 at 12:26 AM, Junio C Hamano<gitster@pobox.com>\n>> wrote:\n>>>\n>>> \"Zeeshan Ali (Khattak)\"<zeeshanak@gnome.org>  writes:\n>>>\n>>>> What about '^' and '^^' that I suggested?\n>\n>\n> If you want a shortcut, you might try this:\n>\n> echo \"ref: HEAD\" > .git/h\n>\n> Then you can use 'h' instead of 'HEAD'.\n>\n> Tested it and it seemed to work. If not someone on this list surely will\n> correct me.\n\nThanks, was hoping to have something thats supported out of the box in\nfuture git but I guess I can settle for a local hack too. :)\n\n\n-- \nRegards,\n\nZeeshan Ali (Khattak)\nFSF member#5124\n"}]}