{"thread":{"id":"26909","subject":"[PATCH] reset: update help text","startedAt":"2011-03-29T13:20:05Z","lastAt":"2011-04-02T08:43:44Z","messageCount":9,"participants":["Nguyễn Thái Ngọc Duy","Nguyen Thai Ngoc Duy","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"164570","messageId":"1301404805-12095-1-git-send-email-pclouds@gmail.com","threadId":"26909","inReplyTo":null,"subject":"[PATCH] reset: update help text","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-29T13:20:05Z","receivedAt":"2011-03-29T13:20:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"State --mixed is the default so users don't have to open up man page.\n\nAlso make it clear how --hard and --merge are different.\n\nMove -q to bottom because it's not that important to pay attention to as\nthe first item.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/reset.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex eb5f98c..7419c9e 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -243,17 +243,17 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \tstruct commit *commit;\n \tchar *reflog_action, msg[1024];\n \tconst struct option options[] = {\n-\t\tOPT__QUIET(&quiet, \"be quiet, only report errors\"),\n \t\tOPT_SET_INT(0, \"mixed\", &reset_type,\n-\t\t\t\t\t\t\"reset HEAD and index\", MIXED),\n+\t\t\t\t\"reset HEAD and index (default)\", MIXED),\n \t\tOPT_SET_INT(0, \"soft\", &reset_type, \"reset only HEAD\", SOFT),\n \t\tOPT_SET_INT(0, \"hard\", &reset_type,\n \t\t\t\t\"reset HEAD, index and working tree\", HARD),\n \t\tOPT_SET_INT(0, \"merge\", &reset_type,\n-\t\t\t\t\"reset HEAD, index and working tree\", MERGE),\n+\t\t\t\t\"like --hard but keep local changes in working tree\", MERGE),\n \t\tOPT_SET_INT(0, \"keep\", &reset_type,\n \t\t\t\t\"reset HEAD but keep local changes\", KEEP),\n \t\tOPT_BOOLEAN('p', \"patch\", &patch_mode, \"select hunks interactively\"),\n+\t\tOPT__QUIET(&quiet, \"be quiet, only report errors\"),\n \t\tOPT_END()\n \t};\n \n-- \n1.7.4.74.g639db\n"},{"id":"164571","messageId":"AANLkTin5CguMu360+hV_QJYHnyEQYeVp05HSBp05UGvr@mail.gmail.com","threadId":"26909","inReplyTo":"1301404805-12095-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] reset: update help text","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-29T13:29:43Z","receivedAt":"2011-03-29T13:29:43Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/29 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> Also make it clear how --hard and --merge are different.\n\nBy the way I don't like the option names --hard, --mixed and --soft.\nThey do not remind me what they actually do. Every time I need to do\nnon-default operation, I have to open man page.\n\nI've been thinking of --ref, --index and --worktree as a more friendly\nversion, which can be combined and converted to --soft, --mixed and\n--hard internally. Invalid combinations will be rejected. That\nthinking went well until I found out there were --merge and --keep,\nand was stuck.\n-- \nDuy\n"},{"id":"164631","messageId":"20110329210457.GA14031@elie","threadId":"26909","inReplyTo":"1301404805-12095-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] reset: update help text","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-29T21:04:57Z","receivedAt":"2011-03-29T21:04:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+cc: Christian, Michael, and Thomas)\nNguyễn Thái Ngọc Duy wrote:\n\n> State --mixed is the default so users don't have to open up man page.\n>\n> Also make it clear how --hard and --merge are different.\n\nThanks; I think the goal of this patch is a good one.\n\n> --- a/builtin/reset.c\n> +++ b/builtin/reset.c\n> @@ -243,17 +243,17 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n>  \tstruct commit *commit;\n>  \tchar *reflog_action, msg[1024];\n>  \tconst struct option options[] = {\n> -\t\tOPT__QUIET(&quiet, \"be quiet, only report errors\"),\n>  \t\tOPT_SET_INT(0, \"mixed\", &reset_type,\n> -\t\t\t\t\t\t\"reset HEAD and index\", MIXED),\n> +\t\t\t\t\"reset HEAD and index (default)\", MIXED),\n\nNice.\n\n>  \t\tOPT_SET_INT(0, \"soft\", &reset_type, \"reset only HEAD\", SOFT),\n>  \t\tOPT_SET_INT(0, \"hard\", &reset_type,\n>  \t\t\t\t\"reset HEAD, index and working tree\", HARD),\n>  \t\tOPT_SET_INT(0, \"merge\", &reset_type,\n> -\t\t\t\t\"reset HEAD, index and working tree\", MERGE),\n> +\t\t\t\t\"like --hard but keep local changes in working tree\", MERGE),\n>  \t\tOPT_SET_INT(0, \"keep\", &reset_type,\n>  \t\t\t\t\"reset HEAD but keep local changes\", KEEP),\n\nThe description does not make it obvious to me how these two (--merge\nand --keep) differ.  I think the intent of the options are:\n\n --keep:\n\tstart working on a different commit, carrying over local changes\n\t(like \"git checkout\")\n --merge:\n\treturn to <commit>, cancelling a merge-like operation that\n\tcreates some unmerged and some clean index entries\n\nMaybe something along these lines could be ok starting point?\n\n\tOPT_SET_INT(0, \"keep\", &reset_type,\n\t\t\"move to <commit>, carrying over local changes in working tree\",\n\t\tKEEP),\n\tOPT_SET_INT(0, \"merge\", &reset_type,\n\t\t\"return to <commit>, cancelling failed merge or cherry-pick\",\n\t\tMERGE),\n"},{"id":"164786","messageId":"AANLkTiknvWE9Fe3u88Jbis4Cgxd5ubqaR6MzYOJZ-AtM@mail.gmail.com","threadId":"26909","inReplyTo":"20110329210457.GA14031@elie","subject":"Re: [PATCH] reset: update help text","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-03-31T12:31:59Z","receivedAt":"2011-03-31T12:31:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/3/30 Jonathan Nieder <jrnieder@gmail.com>:\n> The description does not make it obvious to me how these two (--merge\n> and --keep) differ.  I think the intent of the options are:\n>\n>  --keep:\n>        start working on a different commit, carrying over local changes\n>        (like \"git checkout\")\n>  --merge:\n>        return to <commit>, cancelling a merge-like operation that\n>        creates some unmerged and some clean index entries\n>\n> Maybe something along these lines could be ok starting point?\n>\n>        OPT_SET_INT(0, \"keep\", &reset_type,\n>                \"move to <commit>, carrying over local changes in working tree\",\n>                KEEP),\n>        OPT_SET_INT(0, \"merge\", &reset_type,\n>                \"return to <commit>, cancelling failed merge or cherry-pick\",\n>                MERGE),\n>\n\nTo be honest, I have no idea what the above describes. I read 9bc454d\n(reset: add option \"--keep\" to \"git reset\" - 2010-01-19) and figured\nthat --keep is like --merge except that \"git diff\" before and after\nthe reset is exactly the same, is it? I have never used --keep before.\n-- \nDuy\n"},{"id":"164813","messageId":"20110331184246.GA19264@elie","threadId":"26909","inReplyTo":"AANLkTiknvWE9Fe3u88Jbis4Cgxd5ubqaR6MzYOJZ-AtM@mail.gmail.com","subject":"Re: [PATCH] reset: update help text","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-31T18:42:46Z","receivedAt":"2011-03-31T18:42:46Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n\n> To be honest, I have no idea what the above describes. I read 9bc454d\n> (reset: add option \"--keep\" to \"git reset\" - 2010-01-19) and figured\n> that --keep is like --merge except that \"git diff\" before and after\n> the reset is exactly the same, is it? I have never used --keep before.\n\nI use \"git reset --keep\" to\n\n - discard a bad commit: git reset --keep HEAD^\n - start working against a different commit:\n\n\tgit checkout -b topic &&\n\t... hack hack hack without committing ... &&\n\t: \"oops, I thought I was on master but I was somewhere else\" &&\n\tgit reset --keep master\n\nThe spirit of the thing[1] is:\n\n * if the diff \"HEAD -> <commit>\" touch paths in which we have local\n   changes, error out;\n * otherwise, checkout the relevant paths from <commit> but leave the\n   paths in which we have local changes alone.\n\nwhich indeed means \"git diff --cached\" and \"git diff\" before and after\nwould be exactly the same.  But there are some edge cases, in which\nthe diff \"HEAD -> <commit>\" makes the same change we did and the\nreset --keep is still allowed.\n\nThis is totally different from --merge.  The only legitimate use of\n--merge is to cancel a merge you just performed, imho --- the effect\notherwise is too scary (\"git add <path>; git reset --merge elsewhere\"\n--- bye, bye, changes made at <path>).\n\nHope that helps,\nJonathan\n\n[1] Detailed semantics: for each path listed by \"git diff --name-only\nHEAD <commit>\":\n\n * if the worktree, index, and HEAD match, make the index and worktree\n   match <commit>.\n\n * otherwise, if it is \"not easy\" to keep local changes, error out.\n   We are not going to do a three-way merge.  That is,\n\n   - if the index matches neither HEAD nor <commit>, error out;\n   - if the index matches HEAD but not the worktree, error out.\n\n * otherwise, it is \"easy\", so keep local changes.\n\n   - if the index already matches <commit>, leave the index and\n     worktree alone.\n   - if the index and worktree match HEAD, make them match the\n     <commit> instead.\n\nThese are the same rules used by fast-forward merges and plain\n\"git checkout\".\n"},{"id":"164819","messageId":"7v4o6jku28.fsf@alter.siamese.dyndns.org","threadId":"26909","inReplyTo":"20110329210457.GA14031@elie","subject":"Re: [PATCH] reset: update help text","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-31T18:45:35Z","receivedAt":"2011-03-31T18:45:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> The description does not make it obvious to me how these two (--merge\n> and --keep) differ.  I think the intent of the options are:\n>\n>  --keep:\n> \tstart working on a different commit, carrying over local changes\n> \t(like \"git checkout\")\n>  --merge:\n> \treturn to <commit>, cancelling a merge-like operation that\n> \tcreates some unmerged and some clean index entries\n>\n> Maybe something along these lines could be ok starting point?\n>\n> \tOPT_SET_INT(0, \"keep\", &reset_type,\n> \t\t\"move to <commit>, carrying over local changes in working tree\",\n> \t\tKEEP),\n> \tOPT_SET_INT(0, \"merge\", &reset_type,\n> \t\t\"return to <commit>, cancelling failed merge or cherry-pick\",\n> \t\tMERGE),\n\nI cannot think of anything better, but I can still show my concern that\n\"move to\" and \"return to\" might not convey exactly what we are trying to\nexpress.\n\nBut I agree that your phrasing definitely is a good starting point.\n"},{"id":"164835","messageId":"7v39m3j780.fsf@alter.siamese.dyndns.org","threadId":"26909","inReplyTo":"20110331184246.GA19264@elie","subject":"Re: [PATCH] reset: update help text","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-31T21:44:15Z","receivedAt":"2011-03-31T21:44:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> [1] Detailed semantics: for each path listed by \"git diff --name-only\n> HEAD <commit>\":\n>\n>  * if the worktree, index, and HEAD match, make the index and worktree\n>    match <commit>.\n>\n>  * otherwise, if it is \"not easy\" to keep local changes, error out.\n>    We are not going to do a three-way merge.  That is,\n>\n>    - if the index matches neither HEAD nor <commit>, error out;\n>    - if the index matches HEAD but not the worktree, error out.\n>\n>  * otherwise, it is \"easy\", so keep local changes.\n>\n>    - if the index already matches <commit>, leave the index and\n>      worktree alone.\n>    - if the index and worktree match HEAD, make them match the\n>      <commit> instead.\n\nThe latter item in the last \"otherwise\" is the same as the first \"if all\nmatch, move to the one from the named commit\", isn't it?\n"},{"id":"164838","messageId":"20110331215741.GA20474@elie","threadId":"26909","inReplyTo":"7v39m3j780.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] reset: update help text","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-31T21:57:41Z","receivedAt":"2011-03-31T21:57:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> [1] Detailed semantics: for each path listed by \"git diff --name-only\n>> HEAD <commit>\":\n>>\n>>  * if the worktree, index, and HEAD match, make the index and worktree\n>>    match <commit>.\n>>\n>>  * otherwise, if it is \"not easy\" to keep local changes, error out.\n>>    We are not going to do a three-way merge.  That is,\n>>\n>>    - if the index matches neither HEAD nor <commit>, error out;\n>>    - if the index matches HEAD but not the worktree, error out.\n>>\n>>  * otherwise, it is \"easy\", so keep local changes.\n>>\n>>    - if the index already matches <commit>, leave the index and\n>>      worktree alone.\n>>    - if the index and worktree match HEAD, make them match the\n>>      <commit> instead.\n>\n> The latter item in the last \"otherwise\" is the same as the first \"if all\n> match, move to the one from the named commit\", isn't it?\n\nYes, sorry for the nonsense.\n"},{"id":"164945","messageId":"BANLkTi=m-MYaQZ8_u8-CAXPaVpJi9QDkTg@mail.gmail.com","threadId":"26909","inReplyTo":"20110331184246.GA19264@elie","subject":"Re: [PATCH] reset: update help text","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-04-02T08:43:44Z","receivedAt":"2011-04-02T08:43:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Apr 1, 2011 at 1:42 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Nguyen Thai Ngoc Duy wrote:\n>\n>> To be honest, I have no idea what the above describes. I read 9bc454d\n>> (reset: add option \"--keep\" to \"git reset\" - 2010-01-19) and figured\n>> that --keep is like --merge except that \"git diff\" before and after\n>> the reset is exactly the same, is it? I have never used --keep before.\n>\n> I use \"git reset --keep\" to\n>\n>  - discard a bad commit: git reset --keep HEAD^\n>  - start working against a different commit:\n>\n>        git checkout -b topic &&\n>        ... hack hack hack without committing ... &&\n>        : \"oops, I thought I was on master but I was somewhere else\" &&\n>        git reset --keep master\n>\n> ..\n\nThanks. Your changes make sense to me now.\n-- \nDuy\n"}]}