{"thread":{"id":"25817","subject":"Git reset -p on working tree","startedAt":"2010-11-23T09:11:50Z","lastAt":"2010-11-25T16:14:46Z","messageCount":14,"participants":["Jeenu V","knittl","Štěpán Němec","Jeff King","Michael J Gruber","Jakub Narebski","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"156356","messageId":"AANLkTimc=Dt9YSu=J=7C-f1hZ9UODU7VHu6oD8dmFX3N@mail.gmail.com","threadId":"25817","inReplyTo":null,"subject":"Git reset -p on working tree","fromName":"Jeenu V","fromEmail":"jeenuv@gmail.com","sentAt":"2010-11-23T09:11:50Z","receivedAt":"2010-11-23T09:11:50Z","isPatch":false,"sender":{"key":"jeenuv@gmail.com","avatar":"https://gravatar.com/avatar/0fae51e727209ba442f53fbab775dec62add0884f7a1bf1eb9fee94fb876f2b0?d=mp&s=160"},"body":"Often I find it useful to selectively undo the modifications that I\ndid to my working tree. The -p option to 'reset' that selectively\nresets changes back to a given commit. Unfortunately the option\nreports itself to be incompatible with --{hard,soft,mixed} and thus\ncan't be applied to working tree.\n\nRight now I do this with vimdiff, by applying 'git diff' in reverse.\nWish reset supports -p on working tree operations as well because the\n-p framework (of add, and reset) feels good to use.\n\n-- \nJeenu\n"},{"id":"156357","messageId":"AANLkTimP9zr=wQDYeBxtvYCE1mZ1aHXQ_nLOxGFfR9YD@mail.gmail.com","threadId":"25817","inReplyTo":"AANLkTimc=Dt9YSu=J=7C-f1hZ9UODU7VHu6oD8dmFX3N@mail.gmail.com","subject":"Re: Git reset -p on working tree","fromName":"knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2010-11-23T09:20:31Z","receivedAt":"2010-11-23T09:20:31Z","isPatch":false,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":"On Tue, Nov 23, 2010 at 10:11 AM, Jeenu V <jeenuv@gmail.com> wrote:\n> Often I find it useful to selectively undo the modifications that I\n> did to my working tree. The -p option to 'reset' that selectively\n> resets changes back to a given commit. Unfortunately the option\n> reports itself to be incompatible with --{hard,soft,mixed} and thus\n> can't be applied to working tree.\n>\n> Right now I do this with vimdiff, by applying 'git diff' in reverse.\n> Wish reset supports -p on working tree operations as well because the\n> -p framework (of add, and reset) feels good to use.\n\n\nthere's `git checkout -p` to selectively remove changes from your working tree.\n(also `git stash -p` to selectively stash changes temporarily)\n\n`git reset -p` will only undo staged changes from your index\n\n-- \ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"},{"id":"156361","messageId":"AANLkTimQ644C-dEoJTj8bNd9y+YzpMez7D1KLZFNEe7c@mail.gmail.com","threadId":"25817","inReplyTo":"AANLkTimP9zr=wQDYeBxtvYCE1mZ1aHXQ_nLOxGFfR9YD@mail.gmail.com","subject":"Re: Git reset -p on working tree","fromName":"Jeenu V","fromEmail":"jeenuv@gmail.com","sentAt":"2010-11-23T10:26:08Z","receivedAt":"2010-11-23T10:26:08Z","isPatch":false,"sender":{"key":"jeenuv@gmail.com","avatar":"https://gravatar.com/avatar/0fae51e727209ba442f53fbab775dec62add0884f7a1bf1eb9fee94fb876f2b0?d=mp&s=160"},"body":"On Tue, Nov 23, 2010 at 2:50 PM, knittl <knittl89@googlemail.com> wrote:\n> On Tue, Nov 23, 2010 at 10:11 AM, Jeenu V <jeenuv@gmail.com> wrote:\n>> Often I find it useful to selectively undo the modifications that I\n>> did to my working tree. The -p option to 'reset' that selectively\n>> resets changes back to a given commit. Unfortunately the option\n>> reports itself to be incompatible with --{hard,soft,mixed} and thus\n>> can't be applied to working tree.\n>>\n>> Right now I do this with vimdiff, by applying 'git diff' in reverse.\n>> Wish reset supports -p on working tree operations as well because the\n>> -p framework (of add, and reset) feels good to use.\n>\n>\n> there's `git checkout -p` to selectively remove changes from your working tree.\n> (also `git stash -p` to selectively stash changes temporarily)\n\nSurprised to know that checkout and stash supports it! Thanks a lot\nfor pointing out.\n\n-- \nJeenu\n"},{"id":"156362","messageId":"AANLkTindHnjeXEGbKWiQkWgoUBwqZbdx71sQwNr_gFp0@mail.gmail.com","threadId":"25817","inReplyTo":"AANLkTimQ644C-dEoJTj8bNd9y+YzpMez7D1KLZFNEe7c@mail.gmail.com","subject":"Re: Git reset -p on working tree","fromName":"Jeenu V","fromEmail":"jeenuv@gmail.com","sentAt":"2010-11-23T10:32:43Z","receivedAt":"2010-11-23T10:32:43Z","isPatch":false,"sender":{"key":"jeenuv@gmail.com","avatar":"https://gravatar.com/avatar/0fae51e727209ba442f53fbab775dec62add0884f7a1bf1eb9fee94fb876f2b0?d=mp&s=160"},"body":"On Tue, Nov 23, 2010 at 3:56 PM, Jeenu V <jeenuv@gmail.com> wrote:\n> On Tue, Nov 23, 2010 at 2:50 PM, knittl <knittl89@googlemail.com> wrote:\n>>> Right now I do this with vimdiff, by applying 'git diff' in reverse.\n>>> Wish reset supports -p on working tree operations as well because the\n>>> -p framework (of add, and reset) feels good to use.\n>>\n>>\n>> there's `git checkout -p` to selectively remove changes from your working tree.\n>> (also `git stash -p` to selectively stash changes temporarily)\n>\n> Surprised to know that checkout and stash supports it! Thanks a lot\n> for pointing out.\n\nI think Git could suggest 'checkout -p' and/or 'stash -p' when user\ntries to use -p with --{hard,soft,mixed} with reset command (in\naddition to mentioning that they're incompatible), since relatively\nnew users are used to 'reset' than other commands to reset their\nworking trees.\n\n-- \nJeenu\n"},{"id":"156364","messageId":"AANLkTi=5w3YpYu0_WbmHud0BUkO2BqYNVezWDMkCaSj2@mail.gmail.com","threadId":"25817","inReplyTo":"AANLkTindHnjeXEGbKWiQkWgoUBwqZbdx71sQwNr_gFp0@mail.gmail.com","subject":"Re: Git reset -p on working tree","fromName":"knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2010-11-23T10:58:46Z","receivedAt":"2010-11-23T10:58:46Z","isPatch":false,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":"On Tue, Nov 23, 2010 at 11:32 AM, Jeenu V <jeenuv@gmail.com> wrote:\n> On Tue, Nov 23, 2010 at 3:56 PM, Jeenu V <jeenuv@gmail.com> wrote:\n>> On Tue, Nov 23, 2010 at 2:50 PM, knittl <knittl89@googlemail.com> wrote:\n>>>> Right now I do this with vimdiff, by applying 'git diff' in reverse.\n>>>> Wish reset supports -p on working tree operations as well because the\n>>>> -p framework (of add, and reset) feels good to use.\n>>>\n>>>\n>>> there's `git checkout -p` to selectively remove changes from your working tree.\n>>> (also `git stash -p` to selectively stash changes temporarily)\n>>\n>> Surprised to know that checkout and stash supports it! Thanks a lot\n>> for pointing out.\n>\n> I think Git could suggest 'checkout -p' and/or 'stash -p' when user\n> tries to use -p with --{hard,soft,mixed} with reset command (in\n> addition to mentioning that they're incompatible), since relatively\n> new users are used to 'reset' than other commands to reset their\n> working trees.\n\n`git reset` seldomly affects the working tree, unless using `--hard`,\n`--merge` or `--keep`, and those switches are potentially dangerous if\nyou are not aware of the implications to your worktree and index.\n\nwithout options reset undoes a previous add, i.e. remove changes from\nthe index, but not the working tree.\n\ngit reset manpage mentions git-checkout:\n\n> After running git reset <paths> to update the index entry, you can\n> use git-checkout(1) to check the contents out of the index to the\n> working tree. Alternatively, using git-checkout(1) and specifying a\n> commit, you can copy the contents of a path out of a commit to the\n> index and to the working tree in one go.\n\n\n--\ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"},{"id":"156377","messageId":"AANLkTimEOULR8_PAs5iPu7z+n4DQPSyDKYg8RghZxosz@mail.gmail.com","threadId":"25817","inReplyTo":"AANLkTi=5w3YpYu0_WbmHud0BUkO2BqYNVezWDMkCaSj2@mail.gmail.com","subject":"Re: Git reset -p on working tree","fromName":"Jeenu V","fromEmail":"jeenuv@gmail.com","sentAt":"2010-11-23T13:00:39Z","receivedAt":"2010-11-23T13:00:39Z","isPatch":false,"sender":{"key":"jeenuv@gmail.com","avatar":"https://gravatar.com/avatar/0fae51e727209ba442f53fbab775dec62add0884f7a1bf1eb9fee94fb876f2b0?d=mp&s=160"},"body":"On Tue, Nov 23, 2010 at 4:28 PM, knittl <knittl89@googlemail.com> wrote:\n> `git reset` seldomly affects the working tree, unless using `--hard`,\n> `--merge` or `--keep`, and those switches are potentially dangerous if\n> you are not aware of the implications to your worktree and index.\n>\n> without options reset undoes a previous add, i.e. remove changes from\n> the index, but not the working tree.\n>\n> git reset manpage mentions git-checkout:\n\nAgreed. What I'm saying is most manuals/guides out there tips user to\nuse 'git reset --hard' to discard changes in the working directory and\nrestore the pristine copy of files. 'reset' then becomes synonymous to\ndiscard, and it kind of is but for a different reason. Because other\ncommands offer -p for selective operations, one might try to discard\nselectively, and end up using 'git reset -p --hard', which obviously\nisn't going to work.\n\nKnowing the users intention in such cases, I was suggesting the error\nmessage could hint the right command (just like git commit hints user\nto use git-add when one does 'git commit' with a dirty working tree).\n\nBut that's just me.\n\n-- \nJeenu\n"},{"id":"156388","messageId":"87mxp086k5.fsf_-_@gmail.com","threadId":"25817","inReplyTo":"AANLkTimEOULR8_PAs5iPu7z+n4DQPSyDKYg8RghZxosz@mail.gmail.com","subject":"[PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Štěpán Němec","fromEmail":"stepnem@gmail.com","sentAt":"2010-11-23T14:20:58Z","receivedAt":"2010-11-23T14:20:58Z","isPatch":true,"sender":{"key":"stepnem@gmail.com","avatar":"https://avatars.githubusercontent.com/u/106838?v=4"},"body":"The --patch option to git-reset is not compatible with the type\nspecifiers (--hard et al.), but some users try that first when what they\nreally want is \"checkout -p\" (cf.\n<http://permalink.gmane.org/gmane.comp.version-control.git/161955>).\n\nMention \"git checkout -p\" in the error message to point users in the\nright direction.\n\nSigned-off-by: Štěpán Němec <stepnem@gmail.com>\n---\n\nJeenu V <jeenuv@gmail.com> writes:\n\n> On Tue, Nov 23, 2010 at 4:28 PM, knittl <knittl89@googlemail.com> wrote:\n>> `git reset` seldomly affects the working tree, unless using `--hard`,\n>> `--merge` or `--keep`, and those switches are potentially dangerous if\n>> you are not aware of the implications to your worktree and index.\n>>\n>> without options reset undoes a previous add, i.e. remove changes from\n>> the index, but not the working tree.\n>>\n>> git reset manpage mentions git-checkout:\n>\n> Agreed. What I'm saying is most manuals/guides out there tips user to\n> use 'git reset --hard' to discard changes in the working directory and\n> restore the pristine copy of files. 'reset' then becomes synonymous to\n> discard, and it kind of is but for a different reason. Because other\n> commands offer -p for selective operations, one might try to discard\n> selectively, and end up using 'git reset -p --hard', which obviously\n> isn't going to work.\n>\n> Knowing the users intention in such cases, I was suggesting the error\n> message could hint the right command (just like git commit hints user\n> to use git-add when one does 'git commit' with a dirty working tree).\n>\n> But that's just me.\n\nWell, maybe something like the patch below wouldn't hurt?\n\n builtin/reset.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 0037be4..fc530d2 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \n \tif (patch_mode) {\n \t\tif (reset_type != NONE)\n-\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n+\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n+\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n \t\treturn interactive_reset(rev, argv + i, prefix);\n \t}\n \n-- \n1.7.3.rc2.221.gbf93f.dirty\n"},{"id":"156391","messageId":"20101123145921.GB3145@sigill.intra.peff.net","threadId":"25817","inReplyTo":"87mxp086k5.fsf_-_@gmail.com","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-11-23T14:59:21Z","receivedAt":"2010-11-23T14:59:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 23, 2010 at 03:20:58PM +0100, Štěpán Němec wrote:\n\n> diff --git a/builtin/reset.c b/builtin/reset.c\n> index 0037be4..fc530d2 100644\n> --- a/builtin/reset.c\n> +++ b/builtin/reset.c\n> @@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>  \n>  \tif (patch_mode) {\n>  \t\tif (reset_type != NONE)\n> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>  \t}\n\nShould this actually print something different for --hard versus --mixed\nversus --soft?\n\nFor --soft, \"-p\" simply makes no sense as you are not changing the index\nor the working directory.\n\nFor --mixed, shouldn't we support \"-p\" already, as that is the default\nmode?\n\nFor --hard, suggesting \"checkout -p\" does make sense.\n\nAlso, what about \"--merge\" and \"--keep\" modes?\n\n-Peff\n"},{"id":"156393","messageId":"87ipzo83o9.fsf@gmail.com","threadId":"25817","inReplyTo":"20101123145921.GB3145@sigill.intra.peff.net","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Štěpán Němec","fromEmail":"stepnem@gmail.com","sentAt":"2010-11-23T15:23:18Z","receivedAt":"2010-11-23T15:23:18Z","isPatch":true,"sender":{"key":"stepnem@gmail.com","avatar":"https://avatars.githubusercontent.com/u/106838?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Nov 23, 2010 at 03:20:58PM +0100, Štěpán Němec wrote:\n>\n>> diff --git a/builtin/reset.c b/builtin/reset.c\n>> index 0037be4..fc530d2 100644\n>> --- a/builtin/reset.c\n>> +++ b/builtin/reset.c\n>> @@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>>  \n>>  \tif (patch_mode) {\n>>  \t\tif (reset_type != NONE)\n>> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n>> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n>> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>>  \t}\n>\n> Should this actually print something different for --hard versus --mixed\n> versus --soft?\n>\n> For --soft, \"-p\" simply makes no sense as you are not changing the index\n> or the working directory.\n>\n> For --mixed, shouldn't we support \"-p\" already, as that is the default\n> mode?\n>\n> For --hard, suggesting \"checkout -p\" does make sense.\n>\n> Also, what about \"--merge\" and \"--keep\" modes?\n\nAll good questions, most of which occured to me, too. What I was going\nto do based on the outcome of (the discussion of) this patch was at\nleast fix the currently out-of-date \"--{hard,mixed,soft}\", as the\nerror is signalled with the newer options (--keep and --merge) as well.\nI'm not sure I could cope with anything much more complicated than that,\nesp. if it involved adding some new reset functionality. :-)\n\nWhat about this instead:\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 0037be4..7779302 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -308,8 +308,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \thashcpy(sha1, commit->object.sha1);\n \n \tif (patch_mode) {\n-\t\tif (reset_type != NONE)\n-\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n+\t\tif (reset_type == HARD)\n+\t\t\tdie(\"--patch is incompatible with --hard\\n\"\n+\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n+\t\tif (reset_type != MIXED)\n+\t\t\tdie(\"--patch is incompatible with --{hard,soft,keep,merge}\");\n \t\treturn interactive_reset(rev, argv + i, prefix);\n \t}\n \n\nThanks,\n\n  Štěpán\n"},{"id":"156536","messageId":"4CEE2472.5020901@drmicha.warpmail.net","threadId":"25817","inReplyTo":"87ipzo83o9.fsf@gmail.com","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-11-25T08:55:14Z","receivedAt":"2010-11-25T08:55:14Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Štěpán Němec venit, vidit, dixit 23.11.2010 16:23:\n> Jeff King <peff@peff.net> writes:\n> \n>> On Tue, Nov 23, 2010 at 03:20:58PM +0100, Štěpán Němec wrote:\n>>\n>>> diff --git a/builtin/reset.c b/builtin/reset.c\n>>> index 0037be4..fc530d2 100644\n>>> --- a/builtin/reset.c\n>>> +++ b/builtin/reset.c\n>>> @@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>>>  \n>>>  \tif (patch_mode) {\n>>>  \t\tif (reset_type != NONE)\n>>> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n>>> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n>>> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>>>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>>>  \t}\n>>\n>> Should this actually print something different for --hard versus --mixed\n>> versus --soft?\n>>\n>> For --soft, \"-p\" simply makes no sense as you are not changing the index\n>> or the working directory.\n>>\n>> For --mixed, shouldn't we support \"-p\" already, as that is the default\n>> mode?\n>>\n>> For --hard, suggesting \"checkout -p\" does make sense.\n>>\n>> Also, what about \"--merge\" and \"--keep\" modes?\n> \n> All good questions, most of which occured to me, too. What I was going\n> to do based on the outcome of (the discussion of) this patch was at\n> least fix the currently out-of-date \"--{hard,mixed,soft}\", as the\n> error is signalled with the newer options (--keep and --merge) as well.\n> I'm not sure I could cope with anything much more complicated than that,\n> esp. if it involved adding some new reset functionality. :-)\n\nThe man page for git-reset points at git-checkout already.\n\nUntil we have a \"verbosity level\" config across all commands, I don't\nfavor adding a lot of hints to command error messages.\n\nMichael\n"},{"id":"156543","messageId":"m3mxox4qr3.fsf@localhost.localdomain","threadId":"25817","inReplyTo":"4CEE2472.5020901@drmicha.warpmail.net","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-11-25T10:56:05Z","receivedAt":"2010-11-25T10:56:05Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n> Štěpán Němec venit, vidit, dixit 23.11.2010 16:23:\n>> Jeff King <peff@peff.net> writes:\n>>> On Tue, Nov 23, 2010 at 03:20:58PM +0100, Štěpán Němec wrote:\n>>>\n>>>> diff --git a/builtin/reset.c b/builtin/reset.c\n>>>> index 0037be4..fc530d2 100644\n>>>> --- a/builtin/reset.c\n>>>> +++ b/builtin/reset.c\n>>>> @@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>>>>  \n>>>>  \tif (patch_mode) {\n>>>>  \t\tif (reset_type != NONE)\n>>>> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n>>>> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n>>>> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>>>>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>>>>  \t}\n\n[...]\n> \n> The man page for git-reset points at git-checkout already.\n> \n> Until we have a \"verbosity level\" config across all commands, I don't\n> favor adding a lot of hints to command error messages.\n\nErrrr... but we do have \"verbosity level\" config in the form of\nadvice.* configuration variables.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"156548","messageId":"4CEE604E.2030208@drmicha.warpmail.net","threadId":"25817","inReplyTo":"m3mxox4qr3.fsf@localhost.localdomain","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-11-25T13:10:38Z","receivedAt":"2010-11-25T13:10:38Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jakub Narebski venit, vidit, dixit 25.11.2010 11:56:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>> Štěpán Němec venit, vidit, dixit 23.11.2010 16:23:\n>>> Jeff King <peff@peff.net> writes:\n>>>> On Tue, Nov 23, 2010 at 03:20:58PM +0100, Štěpán Němec wrote:\n>>>>\n>>>>> diff --git a/builtin/reset.c b/builtin/reset.c\n>>>>> index 0037be4..fc530d2 100644\n>>>>> --- a/builtin/reset.c\n>>>>> +++ b/builtin/reset.c\n>>>>> @@ -309,7 +309,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>>>>>  \n>>>>>  \tif (patch_mode) {\n>>>>>  \t\tif (reset_type != NONE)\n>>>>> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n>>>>> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n>>>>> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>>>>>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>>>>>  \t}\n> \n> [...]\n>>\n>> The man page for git-reset points at git-checkout already.\n>>\n>> Until we have a \"verbosity level\" config across all commands, I don't\n>> favor adding a lot of hints to command error messages.\n> \n> Errrr... but we do have \"verbosity level\" config in the form of\n> advice.* configuration variables.\n\n...which is why I wrote \"across all commands\".\n\nIntroducing one config per advice does not scale at all. (Well, it\nscales linearly...)\n\nIf we want our commands to give advice we need something like\n\"verbosity=silent|quiet|moderate|instructive|chatty\" working across all\ncommands.\n\nMichael\n"},{"id":"156558","messageId":"vpqbp5diei5.fsf@bauges.imag.fr","threadId":"25817","inReplyTo":"4CEE2472.5020901@drmicha.warpmail.net","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-11-25T15:56:02Z","receivedAt":"2010-11-25T15:56:02Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>>>>  \tif (patch_mode) {\n>>>>  \t\tif (reset_type != NONE)\n>>>> -\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\");\n>>>> +\t\t\tdie(\"--patch is incompatible with --{hard,mixed,soft}\\n\"\n>>>> +\t\t\t    \"(use \\\"git checkout -p\\\" to selectively discard changes in working directory)\");\n>>>>  \t\treturn interactive_reset(rev, argv + i, prefix);\n>>>>  \t}\n>>>\n>\n> The man page for git-reset points at git-checkout already.\n>\n> Until we have a \"verbosity level\" config across all commands, I don't\n> favor adding a lot of hints to command error messages.\n\nI agree for \"regular output\", but this case is an error message that\nusers should never see. If you see the message, it means you tried a\ncommand that doesn't exist, and I can't imagine a case where this\nwould be disturbing to get an informative message pointing to the\nright command.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"156559","messageId":"20101125161446.GA24426@sigill.intra.peff.net","threadId":"25817","inReplyTo":"vpqbp5diei5.fsf@bauges.imag.fr","subject":"Re: [PATCH] Hint at \"checkout -p\" in the \"reset --patch <type>\" error message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-11-25T16:14:46Z","receivedAt":"2010-11-25T16:14:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Nov 25, 2010 at 04:56:02PM +0100, Matthieu Moy wrote:\n\n> > The man page for git-reset points at git-checkout already.\n> >\n> > Until we have a \"verbosity level\" config across all commands, I don't\n> > favor adding a lot of hints to command error messages.\n> \n> I agree for \"regular output\", but this case is an error message that\n> users should never see. If you see the message, it means you tried a\n> command that doesn't exist, and I can't imagine a case where this\n> would be disturbing to get an informative message pointing to the\n> right command.\n\nI have to agree.  When I introduced advice.*, I had initially intended\nto have \"advice.all\" or similar, so expert users could shut off the\nverbose warnings.\n\nBut I found that I didn't really want it. Most of the advice is for\nmessages like these that you just don't see that often, and the extra\nline of output is simply not that big a deal. For messages that you _do_\nsee every day (e.g., the help in \"git status\"), it is not so cumbersome\nto set the proper config option.\n\nWhich isn't to say I would be against \"advice.all\" (or even\nadvice.commandSuggestions) if somebody submitted a patch for it. I just\ndon't want it personally.\n\nAnd I don't think any of this needs to hold up Štěpán's patch[1]. What has\nhappened in the past is something like:\n\n  1. Somebody introduces new messages. The patch makes it into next.\n\n  2. A developer gets annoyed and creates a patch for advice.whatever.\n\n  3. That patch goes on the appropriate topic and they make it into the\n     release together.\n\nwhich makes sense to me. Then we know the patch in (2) is not just\nbikeshedding, but actually fixes somebody's annoyance. :)\n\n-Peff\n\n[1] Don't take this as an endorsement of the patch. I think the intent\nis good, but I haven't reviewed it carefully to make sure \"git reset -p\n--mixed\" actually works as advertised. Today is American Thanksgiving,\nso I probably won't get to it for a few days.\n"}]}