{"thread":{"id":"46226","subject":"Using '--help' for aliases","startedAt":"2017-06-21T18:41:45Z","lastAt":"2017-06-24T17:20:23Z","messageCount":5,"participants":["Kaartic Sivaraam","Jeff King","Samuel Lijin","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"322838","messageId":"1498070489.32360.14.camel@gmail.com","threadId":"46226","inReplyTo":null,"subject":"Using '--help' for aliases","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-06-21T18:41:29Z","receivedAt":"2017-06-21T18:41:45Z","isPatch":false,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"Hello all,\n\nI am yet another user of 'git alias' (who wouldn't ?). It has become so\nnatural to me to use the aliased version that at some point of time I\ntried the following,\n\n> $ git co --help\n> `git co' is aliased to `checkout'\n\nThat made me wonder. Git is able to inform the user that 'co' is\naliased to 'checkout' but isn't it possible for it to take one step\nmore to display help ? Just wondering if there were any reason for not\ndoing it.\n\n-- \nRegards,\nKaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n"},{"id":"322843","messageId":"20170621185518.nhnqlkbt63hdoate@sigill.intra.peff.net","threadId":"46226","inReplyTo":"1498070489.32360.14.camel@gmail.com","subject":"Re: Using '--help' for aliases","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-21T18:55:19Z","receivedAt":"2017-06-21T18:55:25Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 22, 2017 at 12:11:29AM +0530, Kaartic Sivaraam wrote:\n\n> I am yet another user of 'git alias' (who wouldn't ?). It has become so\n> natural to me to use the aliased version that at some point of time I\n> tried the following,\n> \n> > $ git co --help\n> > `git co' is aliased to `checkout'\n> \n> That made me wonder. Git is able to inform the user that 'co' is\n> aliased to 'checkout' but isn't it possible for it to take one step\n> more to display help ? Just wondering if there were any reason for not\n> doing it.\n\nIt could do that. I think we even discussed it at one point, but I\ndidn't dig up the thread. However, you have the problem that running\n\"man checkout\" is likely to clobber the mention of the alias. So the\nquestion is whether it is more important to tell the user that it's an\nalias (and which options the alias is using!), or to show them the\nreferred command's manpage.\n\n-Peff\n"},{"id":"322844","messageId":"1498072442.32360.20.camel@gmail.com","threadId":"46226","inReplyTo":"20170621185518.nhnqlkbt63hdoate@sigill.intra.peff.net","subject":"Re: Using '--help' for aliases","fromName":"Kaartic Sivaraam","fromEmail":"kaarticsivaraam91196@gmail.com","sentAt":"2017-06-21T19:14:02Z","receivedAt":"2017-06-21T19:14:18Z","isPatch":false,"sender":{"key":"kaartic.sivaraam@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12448084?v=4"},"body":"On Wed, 2017-06-21 at 14:55 -0400, Jeff King wrote:\n> It could do that. I think we even discussed it at one point,\n> but I\n> didn't dig up the thread. However, you have the problem that running\n> \"man checkout\" is likely to clobber the mention of the alias. So the\n> question is whether it is more important to tell the user that it's\n> an\n> alias (and which options the alias is using!),\nNow, that's something I didn't think of. Does seem to quite an issue as\naliases accept argument this.\n\nI seem to be getting the idea of '--help' just now. All these days, I\nwas actually considering it to be another way of getting to the man\npage of a command. Have to play with it a little to see in what other\nways '--help' could help me! In case there's anything that's so useful\nabout it that I'm missing, let me know.\n\n>  or to show them the\n> referred command's manpage.\n> \n> -Peff\n\n-- \nRegards,\nKaartic Sivaraam <kaarticsivaraam91196@gmail.com>\n"},{"id":"322913","messageId":"CAJZjrdXYqmQuxrCuayy2zcwPkR5Gq56caurR+jO107MFrGspBA@mail.gmail.com","threadId":"46226","inReplyTo":"1498072442.32360.20.camel@gmail.com","subject":"Re: Using '--help' for aliases","fromName":"Samuel Lijin","fromEmail":"sxlijin@gmail.com","sentAt":"2017-06-22T05:39:23Z","receivedAt":"2017-06-22T05:40:10Z","isPatch":false,"sender":{"key":"sxlijin@gmail.com","avatar":"https://gravatar.com/avatar/01777bf1eae64e2b4dca97dcac182a6abbcf6fd8cb4d5b8fa33edf9f8cc21746?d=mp&s=160"},"body":"You could also just make the alias a bash function that does git help\ncheckout when you pass the --help flag to the alias.\n"},{"id":"323211","messageId":"20170624172011.5afp3qhrec5ovynl@genre.crustytoothpaste.net","threadId":"46226","inReplyTo":"1498070489.32360.14.camel@gmail.com","subject":"Re: Using '--help' for aliases","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-06-24T17:20:11Z","receivedAt":"2017-06-24T17:20:23Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Thu, Jun 22, 2017 at 12:11:29AM +0530, Kaartic Sivaraam wrote:\n> I am yet another user of 'git alias' (who wouldn't ?). It has become so\n> natural to me to use the aliased version that at some point of time I\n> tried the following,\n> \n> > $ git co --help\n> > `git co' is aliased to `checkout'\n> \n> That made me wonder. Git is able to inform the user that 'co' is\n> aliased to 'checkout' but isn't it possible for it to take one step\n> more to display help ? Just wondering if there were any reason for not\n> doing it.\n\nIt's possible to do if \"co\" is an alias for \"checkout\", but it works\nless well when co is the following[0]:\n\n\tco = \"!f() { if git checkout -h | grep -qs recurse-submodules; \\\n\t\tthen git checkout --recurse-submodules \\\"$@\\\"; \\\n\t\telse git checkout \\\"$@\\\" && git sui; \\\n\t\tfi; };f\"\n\nIf this alias were to run on a Git with that option but without checkout\n--recurse-submodules, then it would print help and then update\nsubmodles, which isn't what I want.\n\n[0] sui is an alias for submodule update --init.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"}]}