{"thread":{"id":"36496","subject":"[PATCH v2 try2 00/14] Officially start moving to the term 'staging area'","startedAt":"2014-04-25T18:12:33Z","lastAt":"2014-04-26T01:33:11Z","messageCount":16,"participants":["Felipe Contreras","Hilco Wijbenga"],"isPatch":true,"patchVersion":2,"patchTotal":14},"messages":[{"id":"239671","messageId":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":null,"subject":"[PATCH v2 try2 00/14] Officially start moving to the term 'staging area'","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:33Z","receivedAt":"2014-04-25T18:12:33Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"tl;dr: everyone except Junio C Hamano and Drew Northup agrees; we should move\naway from the name \"the index\".\n\nIt has been discussed many times in the past that 'index' is not an\nappropriate description for what the high-level user does with it, and\nit has been agreed that 'staging area' is the best term.\n\nThe term 'staging area' is more intuitive for newcomers which are more\nfamiliar with English than with Git, and it seems to be a\nstraightforward mental notion for people with different mother tongues.\n\nIn fact it is so intuitive that it's used already in a lot online\ndocumentation, and the people that do teach Git professionally use this\nterm, because it's easier for many kinds of audiences to grasp.\n\nThe meaning of the words 'cache' and 'index' doesn't represent correctly\nthe mental model of the high-level user:\n\ncache: a 'cache' is a place for easier access; a squirrel caches nuts\nso it doesn't have to go looking for them in the future when it might\nbe much more difficult. Git porcelain is not using the staging area\nfor easier future access; it's not a cache.\n\nindex: an 'index' is a guide of pointers to something else; a book\nindex has a list of entries so the reader can locate information\neasily without having to go through the whole book. Git porcelain is\nnot using the staging area to find out entries quicker; it's not an\nindex.\n\nstage: a 'stage' is a special area designated for convenience in order\nfor some activity to take place; an orator would prepare a stage in\norder for her speak to be successful, otherwise many people might not\nbe able to hear, or see her. Git porcelain is using the staging area\nprecisely as a special area to be separated from the working directory\nfor convenience.\n\nThe term 'stage' is a good noun itself, but also 'staging area', it\nhas a good verb; 'to stage', and a nice past-participle; 'staged'.\n\nThe first step in moving Git towards this term, is first to add --stage\noptions for every command that uses --index or --cache. However, there's\na problem with the 'git apply' command, because it treats --index and\n--cache differently. Different solutions were proposed, including a\nspecial --stage-only option, however, I think the best solution is a\n--[no-]work option to specify if the working directory should be touched\nor not, so --index becomes --staged, and --cached becomes --staged\n--no-work.\n\nIn addition, the 'git stage' command can be extended so the staging area\ncan be brought closer to the user, like other important Git concepts,\nlike 'git branch, 'git tag', and 'git remote'. For example, the command\n'git stage edit' (which allows the user to edit directly the diff from\nHEAD to the staging area) can have a home, where previously there was no\nplace. It would become natural then to do 'git stage diff', and then\n'git stage edit' (to edit the previous diff).\n\nAfter adding the new --stage options and making sure no functionality is\nlost, they can become the recommended ones in the documentation,\neventually, the old ones get deprecated, and eventually obsoleted.\n\nAlso, the documentation would need to be updated to replace many\ninstances of 'the index', with 'the staging area' in porcelain commands.\n\nMoreover, the --stage and --work options also make sense for 'git\nreset', and after these options are added, the complicated table to\nexplain the different behaviors between --soft, --mixed, and --hard\nbecomes so simple it's not needed any more:\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       A       B     C    D     --no-stage  A       B     D\n\t\t\t\t--stage     A       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       A       B     C    C     --no-stage  A       B     C\n\t\t\t\t--stage     A       C     C\n\t\t\t\t--work      C       C     C\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       B     C    D     --no-stage  B       B     D\n\t\t\t\t--stage     B       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       B     C    C     --no-stage  B       B     C\n\t\t\t\t--stage     B       C     C\n\t\t\t\t--work      C       C     C\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       C     C    D     --no-stage  B       C     D\n\t\t\t\t--stage     B       D     D\n\t\t\t\t--work      D       D     D\n\n      working stage HEAD target             working stage HEAD\n      ----------------------------------------------------\n       B       C     C    C     --no-stage  B       C     C\n\t\t\t\t--stage     B       C     C\n\t\t\t\t--work      C       C     C\n\nIt might be possible to do 'git reset --no-stage --work', to reset the\nworking directory, but leave the staging area alone.\n\nFor more reference about the previous discussions:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/197111\nhttp://thread.gmane.org/gmane.comp.version-control.git/166675\nhttp://thread.gmane.org/gmane.comp.version-control.git/115666\nhttp://thread.gmane.org/gmane.comp.version-control.git/233295\n\nI made a summary of all the positions shared towards moving away from the name\n\"index\".\n\nhttp://article.gmane.org/gmane.comp.version-control.git/233469\n\n\nFelipe Contreras (14):\n  Add proper 'stage' command\n  stage: add edit command\n  diff: document --staged\n  grep: add --staged option\n  rm: add --staged option\n  stash: add --stage option to save\n  stash: add --stage to pop and apply\n  submodule: add --staged options\n  apply: add --stage option\n  apply: add --work, --no-work options\n  completion: update --staged options\n  reset: add --stage and --work options\n  reset: allow --keep with --stage\n  completion: update 'git reset' new stage options\n\n Documentation/git-apply.txt            |  11 ++-\n Documentation/git-diff.txt             |   4 +-\n Documentation/git-grep.txt             |   5 +-\n Documentation/git-reset.txt            |   8 +++\n Documentation/git-rm.txt               |   5 +-\n Documentation/git-stage.txt            |  51 +++++++++++--\n Documentation/git-stash.txt            |  14 ++--\n Documentation/git-submodule.txt        |   8 ++-\n Makefile                               |   2 +-\n builtin.h                              |   1 +\n builtin/apply.c                        |   7 ++\n builtin/grep.c                         |   2 +\n builtin/reset.c                        |  27 +++++++\n builtin/rm.c                           |   1 +\n builtin/stage.c                        | 127 +++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |  39 ++++++++--\n git-stash.sh                           |  12 +++-\n git-submodule.sh                       |  10 +--\n git.c                                  |   2 +-\n 19 files changed, 299 insertions(+), 37 deletions(-)\n create mode 100644 builtin/stage.c\n\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239672","messageId":"1398449567-16314-2-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 01/14] Add proper 'stage' command","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:34Z","receivedAt":"2014-04-25T18:12:34Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stage.txt            | 46 +++++++++++++++++++++++++----\n Makefile                               |  2 +-\n builtin.h                              |  1 +\n builtin/stage.c                        | 53 ++++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash | 24 ++++++++++++++-\n git.c                                  |  2 +-\n 6 files changed, 120 insertions(+), 8 deletions(-)\n create mode 100644 builtin/stage.c\n\ndiff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt\nindex ba3fe0d..5b42b29 100644\n--- a/Documentation/git-stage.txt\n+++ b/Documentation/git-stage.txt\n@@ -3,20 +3,56 @@ git-stage(1)\n \n NAME\n ----\n-git-stage - Add file contents to the staging area\n+git-stage - manage the staging area\n \n \n SYNOPSIS\n --------\n [verse]\n-'git stage' args...\n-\n+'git stage' [options] [--] [<paths>...]\n+'git stage add' [options] [--] [<paths>...]\n+'git stage reset' [-q|--patch] [--] [<paths>...]\n+'git stage diff' [options] [<commit>] [--] [<paths>...]\n+'git stage rm' [options] [--] [<paths>...]\n+'git stage apply' [options] [--] [<paths>...]\n \n DESCRIPTION\n -----------\n \n-This is a synonym for linkgit:git-add[1].  Please refer to the\n-documentation of that command.\n+This command is useful to manage the staging area through other subcommands.\n+\n+COMMANDS\n+--------\n+\n+With no arguments, it's a synonym for linkgit:git-add[1].\n+\n+'add'::\n+\n+Adds file contents to the staging area. See linkgit:git-add[1].\n+\n+'reset'::\n+\n+Resets the staging area. See linkgit:git-reset[1].\n+\n+'diff'::\n+\n+View the changes you staged for the next commit. See linkgit:git-diff[1] --staged.\n+\n+'rm'::\n+\n+Remove files from the staging area only. See linkgit:git-rm[1] --staged.\n+\n+'apply'::\n+\n+Apply a patch to the staging area. See linkgit:git-rm[1] --staged.\n+\n+SEE ALSO\n+--------\n+linkgit:git-add[1]\n+linkgit:git-reset[1]\n+linkgit:git-diff[1]\n+linkgit:git-rm[1]\n+linkgit:git-apply[1]\n \n GIT\n ---\ndiff --git a/Makefile b/Makefile\nindex dddaf4f..059cd50 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -589,7 +589,6 @@ BUILT_INS += git-fsck-objects$X\n BUILT_INS += git-init$X\n BUILT_INS += git-merge-subtree$X\n BUILT_INS += git-show$X\n-BUILT_INS += git-stage$X\n BUILT_INS += git-status$X\n BUILT_INS += git-whatchanged$X\n \n@@ -977,6 +976,7 @@ BUILTIN_OBJS += builtin/send-pack.o\n BUILTIN_OBJS += builtin/shortlog.o\n BUILTIN_OBJS += builtin/show-branch.o\n BUILTIN_OBJS += builtin/show-ref.o\n+BUILTIN_OBJS += builtin/stage.o\n BUILTIN_OBJS += builtin/stripspace.o\n BUILTIN_OBJS += builtin/symbolic-ref.o\n BUILTIN_OBJS += builtin/tag.o\ndiff --git a/builtin.h b/builtin.h\nindex c47c110..76b0a48 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -115,6 +115,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);\n extern int cmd_shortlog(int argc, const char **argv, const char *prefix);\n extern int cmd_show(int argc, const char **argv, const char *prefix);\n extern int cmd_show_branch(int argc, const char **argv, const char *prefix);\n+extern int cmd_stage(int argc, const char **argv, const char *prefix);\n extern int cmd_status(int argc, const char **argv, const char *prefix);\n extern int cmd_stripspace(int argc, const char **argv, const char *prefix);\n extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);\ndiff --git a/builtin/stage.c b/builtin/stage.c\nnew file mode 100644\nindex 0000000..7c4d442\n--- /dev/null\n+++ b/builtin/stage.c\n@@ -0,0 +1,53 @@\n+/*\n+ * 'git stage' builtin command\n+ *\n+ * Copyright (C) 2013 Felipe Contreras\n+ */\n+\n+#include \"builtin.h\"\n+#include \"parse-options.h\"\n+\n+static const char *const stage_usage[] = {\n+\tN_(\"git stage [options] [--] <paths>...\"),\n+\tN_(\"git stage add [options] [--] <paths>...\"),\n+\tN_(\"git stage apply [options] [<patch>...]\"),\n+\tN_(\"git stage reset [-q|--patch] [--] <paths>...\"),\n+\tN_(\"git stage diff [options] [<commit]> [--] <paths>...\"),\n+\tN_(\"git stage rm [options] [--] <paths>...\"),\n+\tNULL\n+};\n+\n+int cmd_stage(int argc, const char **argv, const char *prefix)\n+{\n+\tstruct option options[] = { OPT_END() };\n+\n+\targc = parse_options(argc, argv, prefix, options, stage_usage,\n+\t\t\tPARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH);\n+\n+\tif (argc > 1) {\n+\t\tif (!strcmp(argv[1], \"add\"))\n+\t\t\treturn cmd_add(argc - 1, argv + 1, prefix);\n+\t\tif (!strcmp(argv[1], \"reset\"))\n+\t\t\treturn cmd_reset(argc - 1, argv + 1, prefix);\n+\t\tif (!strcmp(argv[1], \"diff\")) {\n+\t\t\targv[0] = \"diff\";\n+\t\t\targv[1] = \"--staged\";\n+\n+\t\t\treturn cmd_diff(argc, argv, prefix);\n+\t\t}\n+\t\tif (!strcmp(argv[1], \"rm\")) {\n+\t\t\targv[0] = \"rm\";\n+\t\t\targv[1] = \"--cached\";\n+\n+\t\t\treturn cmd_rm(argc, argv, prefix);\n+\t\t}\n+\t\tif (!strcmp(argv[1], \"apply\")) {\n+\t\t\targv[0] = \"apply\";\n+\t\t\targv[1] = \"--cached\";\n+\n+\t\t\treturn cmd_apply(argc, argv, prefix);\n+\t\t}\n+\t}\n+\n+\treturn cmd_add(argc, argv, prefix);\n+}\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 9525343..0521d52 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1705,7 +1705,29 @@ _git_send_email ()\n \n _git_stage ()\n {\n-\t_git_add\n+\t__git_has_doubledash && return\n+\n+\tlocal subcommands=\"add reset diff rm apply\"\n+\tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n+\tif [ -z \"$subcommand\" ]; then\n+\t\t__gitcomp \"$subcommands\"\n+\t\treturn\n+\tfi\n+\n+\tcase \"$subcommand\" in\n+\tadd)\n+\t\t_git_add;;\n+\treset)\n+\t\t_git_reset;;\n+\tdiff)\n+\t\t_git_diff;;\n+\trm)\n+\t\t_git_rm;;\n+\tapply)\n+\t\t_git_apply;;\n+\t*)\n+\t\t_git_add;\n+\tesac\n }\n \n __git_config_get_set_variables ()\ndiff --git a/git.c b/git.c\nindex 7cf2953..844434c 100644\n--- a/git.c\n+++ b/git.c\n@@ -428,7 +428,7 @@ static struct cmd_struct commands[] = {\n \t{ \"show\", cmd_show, RUN_SETUP },\n \t{ \"show-branch\", cmd_show_branch, RUN_SETUP },\n \t{ \"show-ref\", cmd_show_ref, RUN_SETUP },\n-\t{ \"stage\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n+\t{ \"stage\", cmd_stage, RUN_SETUP | NEED_WORK_TREE },\n \t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE },\n \t{ \"stripspace\", cmd_stripspace },\n \t{ \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239686","messageId":"1398449567-16314-3-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 02/14] stage: add edit command","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:35Z","receivedAt":"2014-04-25T18:12:35Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stage.txt            |  5 +++\n builtin/stage.c                        | 74 ++++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |  4 +-\n 3 files changed, 82 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt\nindex 5b42b29..13a01c8 100644\n--- a/Documentation/git-stage.txt\n+++ b/Documentation/git-stage.txt\n@@ -15,6 +15,7 @@ SYNOPSIS\n 'git stage diff' [options] [<commit>] [--] [<paths>...]\n 'git stage rm' [options] [--] [<paths>...]\n 'git stage apply' [options] [--] [<paths>...]\n+'git stage edit'\n \n DESCRIPTION\n -----------\n@@ -46,6 +47,10 @@ Remove files from the staging area only. See linkgit:git-rm[1] --staged.\n \n Apply a patch to the staging area. See linkgit:git-rm[1] --staged.\n \n+'edit'::\n+\n+Manually edit the staging area (as a diff).\n+\n SEE ALSO\n --------\n linkgit:git-add[1]\ndiff --git a/builtin/stage.c b/builtin/stage.c\nindex 7c4d442..f537c1d 100644\n--- a/builtin/stage.c\n+++ b/builtin/stage.c\n@@ -6,6 +6,9 @@\n \n #include \"builtin.h\"\n #include \"parse-options.h\"\n+#include \"diff.h\"\n+#include \"diffcore.h\"\n+#include \"revision.h\"\n \n static const char *const stage_usage[] = {\n \tN_(\"git stage [options] [--] <paths>...\"),\n@@ -17,6 +20,74 @@ static const char *const stage_usage[] = {\n \tNULL\n };\n \n+static int do_reset(const char *prefix)\n+{\n+\tconst char *argv[] = { \"reset\", \"--quiet\", NULL };\n+\treturn cmd_reset(2, argv, prefix);\n+}\n+\n+static int do_apply(const char *file, const char *prefix)\n+{\n+\tconst char *argv[] = { \"apply\", \"--recount\", \"--cached\", file, NULL };\n+\treturn cmd_apply(4, argv, prefix);\n+}\n+\n+static int edit(int argc, const char **argv, const char *prefix)\n+{\n+\tchar *file = git_pathdup(\"STAGE_EDIT.patch\");\n+\tint out;\n+\tstruct rev_info rev;\n+\tint ret = 0;\n+\tstruct stat st;\n+\n+\tread_cache();\n+\n+\tinit_revisions(&rev, prefix);\n+\trev.diffopt.context = 7;\n+\n+\targc = setup_revisions(argc, argv, &rev, NULL);\n+\tadd_head_to_pending(&rev);\n+\tif (!rev.pending.nr) {\n+\t\tstruct tree *tree;\n+\t\ttree = lookup_tree(EMPTY_TREE_SHA1_BIN);\n+\t\tadd_pending_object(&rev, &tree->object, \"HEAD\");\n+\t}\n+\n+\trev.diffopt.output_format = DIFF_FORMAT_PATCH;\n+\trev.diffopt.use_color = 0;\n+\tDIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);\n+\n+\tout = open(file, O_CREAT | O_WRONLY, 0666);\n+\tif (out < 0)\n+\t\tdie(_(\"Could not open '%s' for writing.\"), file);\n+\trev.diffopt.file = xfdopen(out, \"w\");\n+\trev.diffopt.close_file = 1;\n+\n+\tif (run_diff_index(&rev, 1))\n+\t\tdie(_(\"Could not write patch\"));\n+\tif (launch_editor(file, NULL, NULL))\n+\t\texit(1);\n+\n+\tif (stat(file, &st))\n+\t\tdie_errno(_(\"Could not stat '%s'\"), file);\n+\n+\tret = do_reset(prefix);\n+\tif (ret)\n+\t\tgoto leave;\n+\n+\tif (!st.st_size)\n+\t\tgoto leave;\n+\n+\tret = do_apply(file, prefix);\n+\tif (ret)\n+\t\tgoto leave;\n+\n+leave:\n+\tunlink(file);\n+\tfree(file);\n+\treturn ret;\n+}\n+\n int cmd_stage(int argc, const char **argv, const char *prefix)\n {\n \tstruct option options[] = { OPT_END() };\n@@ -47,6 +118,9 @@ int cmd_stage(int argc, const char **argv, const char *prefix)\n \n \t\t\treturn cmd_apply(argc, argv, prefix);\n \t\t}\n+\t\tif (!strcmp(argv[1], \"edit\")) {\n+\t\t\treturn edit(argc - 1, argv + 1, prefix);\n+\t\t}\n \t}\n \n \treturn cmd_add(argc, argv, prefix);\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0521d52..2ec7b1a 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1707,7 +1707,7 @@ _git_stage ()\n {\n \t__git_has_doubledash && return\n \n-\tlocal subcommands=\"add reset diff rm apply\"\n+\tlocal subcommands=\"add reset diff rm apply edit\"\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n \t\t__gitcomp \"$subcommands\"\n@@ -1725,6 +1725,8 @@ _git_stage ()\n \t\t_git_rm;;\n \tapply)\n \t\t_git_apply;;\n+\tedit)\n+\t\t;;\n \t*)\n \t\t_git_add;\n \tesac\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239674","messageId":"1398449567-16314-4-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 03/14] diff: document --staged","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:36Z","receivedAt":"2014-04-25T18:12:36Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-diff.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 56fb7e5..ca2a0ed 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git diff' [options] [<commit>] [--] [<path>...]\n-'git diff' [options] --cached [<commit>] [--] [<path>...]\n+'git diff' [options] [--cached|--staged] [<commit>] [--] [<path>...]\n 'git diff' [options] <commit> <commit> [--] [<path>...]\n 'git diff' [options] <blob> <blob>\n 'git diff' [options] [--no-index] [--] <path> <path>\n@@ -38,7 +38,7 @@ two blob objects, or changes between two files on disk.\n \tor when running the command outside a working tree\n \tcontrolled by Git.\n \n-'git diff' [--options] --cached [<commit>] [--] [<path>...]::\n+'git diff' [--options] [--cached|--staged] [<commit>] [--] [<path>...]::\n \n \tThis form is to view the changes you staged for the next\n \tcommit relative to the named <commit>.  Typically you\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239673","messageId":"1398449567-16314-5-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 04/14] grep: add --staged option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:37Z","receivedAt":"2014-04-25T18:12:37Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-grep.txt | 5 ++++-\n builtin/grep.c             | 2 ++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt\nindex f837334..6ed84d7 100644\n--- a/Documentation/git-grep.txt\n+++ b/Documentation/git-grep.txt\n@@ -25,7 +25,7 @@ SYNOPSIS\n \t   [-W | --function-context]\n \t   [-f <file>] [-e] <pattern>\n \t   [--and|--or|--not|(|)|-e <pattern>...]\n-\t   [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...]\n+\t   [ [--[no-]exclude-standard] [--cached | --staged | --no-index | --untracked] | <tree>...]\n \t   [--] [<pathspec>...]\n \n DESCRIPTION\n@@ -60,6 +60,9 @@ OPTIONS\n \tInstead of searching tracked files in the working tree, search\n \tblobs registered in the index file.\n \n+--staged::\n+\tSynonym for `--cached`.\n+\n --no-index::\n \tSearch files in the current directory that is not managed by Git.\n \ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 69ac2d8..dc2edaf 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -638,6 +638,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tstruct option options[] = {\n \t\tOPT_BOOL(0, \"cached\", &cached,\n \t\t\tN_(\"search in index instead of in the work tree\")),\n+\t\tOPT_BOOL(0, \"staged\", &cached,\n+\t\t\tN_(\"search in index instead of in the work tree\")),\n \t\tOPT_NEGBIT(0, \"no-index\", &use_index,\n \t\t\t N_(\"find in contents not managed by git\"), 1),\n \t\tOPT_BOOL(0, \"untracked\", &untracked,\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239675","messageId":"1398449567-16314-6-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 05/14] rm: add --staged option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:38Z","receivedAt":"2014-04-25T18:12:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-rm.txt | 5 ++++-\n builtin/rm.c             | 1 +\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex f1efc11..458880b 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -8,7 +8,7 @@ git-rm - Remove files from the working tree and from the index\n SYNOPSIS\n --------\n [verse]\n-'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...\n+'git rm' [-f | --force] [-n] [-r] [--cached | --staged] [--ignore-unmatch] [--quiet] [--] <file>...\n \n DESCRIPTION\n -----------\n@@ -60,6 +60,9 @@ OPTIONS\n \tWorking tree files, whether modified or not, will be\n \tleft alone.\n \n+--staged::\n+\tSynonym for --cached.\n+\n --ignore-unmatch::\n \tExit with a zero status even if no files matched.\n \ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 0564218..657314e 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -269,6 +269,7 @@ static struct option builtin_rm_options[] = {\n \tOPT__DRY_RUN(&show_only, N_(\"dry run\")),\n \tOPT__QUIET(&quiet, N_(\"do not list removed files\")),\n \tOPT_BOOL( 0 , \"cached\",         &index_only, N_(\"only remove from the index\")),\n+\tOPT_BOOL( 0 , \"staged\",         &index_only, N_(\"only remove from the index\")),\n \tOPT__FORCE(&force, N_(\"override the up-to-date check\")),\n \tOPT_BOOL('r', NULL,             &recursive,  N_(\"allow recursive removal\")),\n \tOPT_BOOL( 0 , \"ignore-unmatch\", &ignore_unmatch,\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239676","messageId":"1398449567-16314-7-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 06/14] stash: add --stage option to save","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:39Z","receivedAt":"2014-04-25T18:12:39Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"--no-stage is synonym for --keep-index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stash.txt | 6 +++---\n git-stash.sh                | 8 +++++++-\n 2 files changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex db7e803..21a01c2 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -13,7 +13,7 @@ SYNOPSIS\n 'git stash' drop [-q|--quiet] [<stash>]\n 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n 'git stash' branch <branchname> [<stash>]\n-'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n+'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t     [-u|--include-untracked] [-a|--all] [<message>]]\n 'git stash' clear\n 'git stash' create [<message>]\n@@ -44,7 +44,7 @@ is also possible).\n OPTIONS\n -------\n \n-save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::\n+save [-p|--patch] [--[no-]keep-index|--[no-]stage] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]::\n \n \tSave your local modifications to a new 'stash', and run `git reset\n \t--hard` to revert them.  The <message> part is optional and gives\n@@ -54,7 +54,7 @@ save [-p|--patch] [--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--\n \tsubcommand from making an unwanted stash.\n +\n If the `--keep-index` option is used, all changes already added to the\n-index are left intact.\n+index are left intact. Same with `--no-stage`, which is a synonym.\n +\n If the `--include-untracked` option is used, all untracked files are also\n stashed and then cleaned up with `git clean`, leaving the working directory\ndiff --git a/git-stash.sh b/git-stash.sh\nindex f0a94ab..bff4ecc 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -7,7 +7,7 @@ USAGE=\"list [<options>]\n    or: $dashless drop [-q|--quiet] [<stash>]\n    or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n    or: $dashless branch <branchname> [<stash>]\n-   or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]\n+   or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t\t       [-u|--include-untracked] [-a|--all] [<message>]]\n    or: $dashless clear\"\n \n@@ -204,6 +204,12 @@ save_stash () {\n \t\t--no-keep-index)\n \t\t\tkeep_index=n\n \t\t\t;;\n+\t\t--stage)\n+\t\t\tkeep_index=n\n+\t\t\t;;\n+\t\t--no-stage)\n+\t\t\tkeep_index=t\n+\t\t\t;;\n \t\t-p|--patch)\n \t\t\tpatch_mode=t\n \t\t\t# only default to keep if we don't already have an override\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239677","messageId":"1398449567-16314-8-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 07/14] stash: add --stage to pop and apply","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:40Z","receivedAt":"2014-04-25T18:12:40Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym of --index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-stash.txt | 8 ++++----\n git-stash.sh                | 4 ++--\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 21a01c2..5fdaa35 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n 'git stash' list [<options>]\n 'git stash' show [<stash>]\n 'git stash' drop [-q|--quiet] [<stash>]\n-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n+'git stash' ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]\n 'git stash' branch <branchname> [<stash>]\n 'git stash' [save [-p|--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t     [-u|--include-untracked] [-a|--all] [<message>]]\n@@ -96,7 +96,7 @@ show [<stash>]::\n \tit will accept any format known to 'git diff' (e.g., `git stash show\n \t-p stash@{1}` to view the second most recent stash in patch form).\n \n-pop [--index] [-q|--quiet] [<stash>]::\n+pop [--index|--stage] [-q|--quiet] [<stash>]::\n \n \tRemove a single stashed state from the stash list and apply it\n \ton top of the current working tree state, i.e., do the inverse\n@@ -110,12 +110,12 @@ and call `git stash drop` manually afterwards.\n If the `--index` option is used, then tries to reinstate not only the working\n tree's changes, but also the index's ones. However, this can fail, when you\n have conflicts (which are stored in the index, where you therefore can no\n-longer apply the changes as they were originally).\n+longer apply the changes as they were originally). `--stage` is a synonym.\n +\n When no `<stash>` is given, `stash@{0}` is assumed, otherwise `<stash>` must\n be a reference of the form `stash@{<revision>}`.\n \n-apply [--index] [-q|--quiet] [<stash>]::\n+apply [--index|--stage] [-q|--quiet] [<stash>]::\n \n \tLike `pop`, but do not remove the state from the stash list. Unlike `pop`,\n \t`<stash>` may be any commit that looks like a commit created by\ndiff --git a/git-stash.sh b/git-stash.sh\nindex bff4ecc..0f764fe 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -5,7 +5,7 @@ dashless=$(basename \"$0\" | sed -e 's/-/ /')\n USAGE=\"list [<options>]\n    or: $dashless show [<stash>]\n    or: $dashless drop [-q|--quiet] [<stash>]\n-   or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n+   or: $dashless ( pop | apply ) [--index|--stage] [-q|--quiet] [<stash>]\n    or: $dashless branch <branchname> [<stash>]\n    or: $dashless [save [--patch] [-k|--[no-]keep-index|--[no-]stage] [-q|--quiet]\n \t\t       [-u|--include-untracked] [-a|--all] [<message>]]\n@@ -373,7 +373,7 @@ parse_flags_and_rev()\n \t\t\t-q|--quiet)\n \t\t\t\tGIT_QUIET=-t\n \t\t\t;;\n-\t\t\t--index)\n+\t\t\t--index|--stage)\n \t\t\t\tINDEX_OPTION=--index\n \t\t\t;;\n \t\t\t-*)\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239678","messageId":"1398449567-16314-9-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 08/14] submodule: add --staged options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:41Z","receivedAt":"2014-04-25T18:12:41Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --cached.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-submodule.txt |  8 ++++++--\n git-submodule.sh                | 10 +++++-----\n 2 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex bfef8a0..904e007 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -11,13 +11,13 @@ SYNOPSIS\n [verse]\n 'git submodule' [--quiet] add [-b <branch>] [-f|--force] [--name <name>]\n \t      [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]\n-'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]\n+'git submodule' [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]\n 'git submodule' [--quiet] init [--] [<path>...]\n 'git submodule' [--quiet] deinit [-f|--force] [--] <path>...\n 'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]\n \t      [-f|--force] [--rebase] [--reference <repository>] [--depth <depth>]\n \t      [--merge] [--recursive] [--] [<path>...]\n-'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]\n+'git submodule' [--quiet] summary [--cached|--staged|--files] [(-n|--summary-limit) <n>]\n \t      [commit] [--] [<path>...]\n 'git submodule' [--quiet] foreach [--recursive] <command>\n 'git submodule' [--quiet] sync [--] [<path>...]\n@@ -248,6 +248,10 @@ OPTIONS\n \tcommands typically use the commit found in the submodule HEAD, but\n \twith this option, the commit stored in the index is used instead.\n \n+\n+--staged::\n+\tSynonym for `--cached`.\n+\n --files::\n \tThis option is only valid for the summary command. This command\n \tcompares the commit in the index with that in the submodule HEAD\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 4a30087..af6df79 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -6,11 +6,11 @@\n \n dashless=$(basename \"$0\" | sed -e 's/-/ /')\n USAGE=\"[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]\n-   or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]\n+   or: $dashless [--quiet] status [--cached|--staged] [--recursive] [--] [<path>...]\n    or: $dashless [--quiet] init [--] [<path>...]\n    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...\n    or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n-   or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n+   or: $dashless [--quiet] summary [--cached|--staged|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n    or: $dashless [--quiet] foreach [--recursive] <command>\n    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n OPTIONS_SPEC=\n@@ -995,7 +995,7 @@ cmd_summary() {\n \twhile test $# -ne 0\n \tdo\n \t\tcase \"$1\" in\n-\t\t--cached)\n+\t\t--cached|--staged)\n \t\t\tcached=\"$1\"\n \t\t\t;;\n \t\t--files)\n@@ -1200,7 +1200,7 @@ cmd_status()\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n-\t\t--cached)\n+\t\t--cached|--staged)\n \t\t\tcached=1\n \t\t\t;;\n \t\t--recursive)\n@@ -1367,7 +1367,7 @@ do\n \t\tesac\n \t\tbranch=\"$2\"; shift\n \t\t;;\n-\t--cached)\n+\t--cached|--staged)\n \t\tcached=\"$1\"\n \t\t;;\n \t--)\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239679","messageId":"1398449567-16314-10-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 09/14] apply: add --stage option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:42Z","receivedAt":"2014-04-25T18:12:42Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Synonym for --index.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-apply.txt | 5 ++++-\n builtin/apply.c             | 2 ++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex f605327..8c047ef 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -9,7 +9,7 @@ git-apply - Apply a patch to files and/or to the index\n SYNOPSIS\n --------\n [verse]\n-'git apply' [--stat] [--numstat] [--summary] [--check] [--index] [--3way]\n+'git apply' [--stat] [--numstat] [--summary] [--check] [--index|--stage] [--3way]\n \t  [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse]\n \t  [--allow-binary-replacement | --binary] [--reject] [-z]\n \t  [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached]\n@@ -67,6 +67,9 @@ OPTIONS\n \tup-to-date, it is flagged as an error.  This flag also\n \tcauses the index file to be updated.\n \n+--stage::\n+\tSynonym for --index.\n+\n --cached::\n \tApply a patch without touching the working tree. Instead take the\n \tcached data, apply the patch, and store the result in the index\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex b0d0986..a97363c 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -4377,6 +4377,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \t\t\tN_(\"instead of applying the patch, see if the patch is applicable\")),\n \t\tOPT_BOOL(0, \"index\", &check_index,\n \t\t\tN_(\"make sure the patch is applicable to the current index\")),\n+\t\tOPT_BOOL(0, \"stage\", &check_index,\n+\t\t\tN_(\"make sure the patch is applicable to the current index\")),\n \t\tOPT_BOOL(0, \"cached\", &cached,\n \t\t\tN_(\"apply a patch without touching the working tree\")),\n \t\tOPT_BOOL(0, \"apply\", &force_apply,\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239681","messageId":"1398449567-16314-11-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 10/14] apply: add --work, --no-work options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:43Z","receivedAt":"2014-04-25T18:12:43Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"'git apply', 'git apply --index', 'git apply --cached' do different\nthings, but what they do is not precisely clear, specially since no\nother commands has similar distinctions.\n\nWith --no-work (--work being the default), it's clear what the option\nwould do; modify, or not, the working directory.\n\nSo, --work (the default), doesn't cause any changes, and --no-work\nenables the current --cache if used with --index.\n\nEventually --work might replace --cache, if these options are\nstandarized in the whole git toolset.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-apply.txt | 6 +++++-\n builtin/apply.c             | 5 +++++\n 2 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt\nindex 8c047ef..95f5485 100644\n--- a/Documentation/git-apply.txt\n+++ b/Documentation/git-apply.txt\n@@ -16,7 +16,7 @@ SYNOPSIS\n \t  [--ignore-space-change | --ignore-whitespace ]\n \t  [--whitespace=(nowarn|warn|fix|error|error-all)]\n \t  [--exclude=<path>] [--include=<path>] [--directory=<root>]\n-\t  [--verbose] [<patch>...]\n+\t  [--verbose] [--no-work] [<patch>...]\n \n DESCRIPTION\n -----------\n@@ -75,6 +75,10 @@ OPTIONS\n \tcached data, apply the patch, and store the result in the index\n \twithout using the working tree. This implies `--index`.\n \n+--[no-]work::\n+\tApply a patch with or without touching the working tree, essentially\n+\t`--no-work` plus `--index` are the equivalent of `--cached`.\n+\n -3::\n --3way::\n \tWhen the patch does not apply cleanly, fall back on 3-way merge if\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex a97363c..68cdef1 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -4350,6 +4350,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \tint errs = 0;\n \tint is_not_gitdir = !startup_info->have_repository;\n \tint force_apply = 0;\n+\tint work = 1;\n \n \tconst char *whitespace_option = NULL;\n \n@@ -4381,6 +4382,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \t\t\tN_(\"make sure the patch is applicable to the current index\")),\n \t\tOPT_BOOL(0, \"cached\", &cached,\n \t\t\tN_(\"apply a patch without touching the working tree\")),\n+\t\tOPT_BOOL(0, \"work\", &work,\n+\t\t\tN_(\"modify the working tree\")),\n \t\tOPT_BOOL(0, \"apply\", &force_apply,\n \t\t\tN_(\"also apply the patch (use with --stat/--summary/--check)\")),\n \t\tOPT_BOOL('3', \"3way\", &threeway,\n@@ -4433,6 +4436,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)\n \targc = parse_options(argc, argv, prefix, builtin_apply_options,\n \t\t\tapply_usage, 0);\n \n+\tif (check_index && !work)\n+\t\tcached = 1;\n \tif (apply_with_reject && threeway)\n \t\tdie(\"--reject and --3way cannot be used together.\");\n \tif (cached && threeway)\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239680","messageId":"1398449567-16314-12-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 11/14] completion: update --staged options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:44Z","receivedAt":"2014-04-25T18:12:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 2ec7b1a..52d83f2 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -889,7 +889,7 @@ _git_apply ()\n \t\t__gitcomp \"\n \t\t\t--stat --numstat --summary --check --index\n \t\t\t--cached --index-info --reverse --reject --unidiff-zero\n-\t\t\t--apply --no-add --exclude=\n+\t\t\t--apply --no-add --exclude= --staged\n \t\t\t--ignore-whitespace --ignore-space-change\n \t\t\t--whitespace= --inaccurate-eof --verbose\n \t\t\t\"\n@@ -1302,7 +1302,7 @@ _git_grep ()\n \tcase \"$cur\" in\n \t--*)\n \t\t__gitcomp \"\n-\t\t\t--cached\n+\t\t\t--cached --staged\n \t\t\t--text --ignore-case --word-regexp --invert-match\n \t\t\t--full-name --line-number\n \t\t\t--extended-regexp --basic-regexp --fixed-strings\n@@ -2270,7 +2270,7 @@ _git_rm ()\n {\n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp \"--cached --dry-run --ignore-unmatch --quiet\"\n+\t\t__gitcomp \"--cached --staged --dry-run --ignore-unmatch --quiet\"\n \t\treturn\n \t\t;;\n \tesac\n@@ -2337,7 +2337,7 @@ _git_show_branch ()\n \n _git_stash ()\n {\n-\tlocal save_opts='--keep-index --no-keep-index --quiet --patch'\n+\tlocal save_opts='--keep-index --no-keep-index --stage --no-stage --quiet --patch'\n \tlocal subcommands='save list show apply clear drop pop create branch'\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n@@ -2357,7 +2357,7 @@ _git_stash ()\n \t\t\t__gitcomp \"$save_opts\"\n \t\t\t;;\n \t\tapply,--*|pop,--*)\n-\t\t\t__gitcomp \"--index --quiet\"\n+\t\t\t__gitcomp \"--index --stage --quiet\"\n \t\t\t;;\n \t\tshow,--*|drop,--*|branch,--*)\n \t\t\t;;\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239683","messageId":"1398449567-16314-13-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 12/14] reset: add --stage and --work options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:45Z","receivedAt":"2014-04-25T18:12:45Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-reset.txt |  8 ++++++++\n builtin/reset.c             | 20 ++++++++++++++++++++\n 2 files changed, 28 insertions(+)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex f445cb3..5cd75a8 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -11,6 +11,7 @@ SYNOPSIS\n 'git reset' [-q] [<tree-ish>] [--] <paths>...\n 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]\n 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n+'git reset' [--stage | --work] [-q] [<commit>]\n \n DESCRIPTION\n -----------\n@@ -81,6 +82,13 @@ but carries forward unmerged index entries.\n \tdifferent between <commit> and HEAD.\n \tIf a file that is different between <commit> and HEAD has local changes,\n \treset is aborted.\n+\n+--stage::\n+\tReset the index, basically `--mixed`. `--no-stage` is the equivalent of\n+\t`--soft`.\n+\n+--work::\n+\tResets the working tree, basically `--hard`.\n --\n \n If you want to undo a commit other than the latest on a branch,\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex a991344..c40987e 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -23,6 +23,7 @@\n \n static const char * const git_reset_usage[] = {\n \tN_(\"git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\"),\n+\tN_(\"git reset [--stage | --work] [-q] [<commit>]\"),\n \tN_(\"git reset [-q] <tree-ish> [--] <paths>...\"),\n \tN_(\"git reset --patch [<tree-ish>] [--] [<paths>...]\"),\n \tNULL\n@@ -254,6 +255,7 @@ static int reset_refs(const char *rev, const unsigned char *sha1)\n int cmd_reset(int argc, const char **argv, const char *prefix)\n {\n \tint reset_type = NONE, update_ref_status = 0, quiet = 0;\n+\tint stage = -1, working_tree = -1;\n \tint patch_mode = 0, unborn;\n \tconst char *rev;\n \tunsigned char sha1[20];\n@@ -269,6 +271,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\t\tN_(\"reset HEAD, index and working tree\"), MERGE),\n \t\tOPT_SET_INT(0, \"keep\", &reset_type,\n \t\t\t\tN_(\"reset HEAD but keep local changes\"), KEEP),\n+\t\tOPT_BOOL(0, \"stage\", &stage, N_(\"reset index\")),\n+\t\tOPT_BOOL(0, \"work\", &working_tree, N_(\"reset working tree\")),\n \t\tOPT_BOOL('p', \"patch\", &patch_mode, N_(\"select hunks interactively\")),\n \t\tOPT_END()\n \t};\n@@ -301,6 +305,22 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\thashcpy(sha1, tree->object.sha1);\n \t}\n \n+\tif (stage >= 0 || working_tree >= 0) {\n+\t\tif (reset_type != NONE)\n+\t\t\tdie(_(\"--{stage,work} are incompatible with --{hard,mixed,soft,merge}\"));\n+\n+\t\tif (working_tree == 1) {\n+\t\t\tif (stage == 0)\n+\t\t\t\tdie(_(\"--no-stage doesn't make sense with --work\"));\n+\t\t\treset_type = HARD;\n+\t\t} else {\n+\t\t\tif (stage == 1)\n+\t\t\t\treset_type = NONE;\n+\t\t\telse\n+\t\t\t\treset_type = SOFT;\n+\t\t}\n+\t}\n+\n \tif (patch_mode) {\n \t\tif (reset_type != NONE)\n \t\t\tdie(_(\"--patch is incompatible with --{hard,mixed,soft}\"));\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239682","messageId":"1398449567-16314-14-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 13/14] reset: allow --keep with --stage","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:46Z","receivedAt":"2014-04-25T18:12:46Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-reset.txt |  2 +-\n builtin/reset.c             | 13 ++++++++++---\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt\nindex 5cd75a8..a1419c9 100644\n--- a/Documentation/git-reset.txt\n+++ b/Documentation/git-reset.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n 'git reset' [-q] [<tree-ish>] [--] <paths>...\n 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]\n 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]\n-'git reset' [--stage | --work] [-q] [<commit>]\n+'git reset' [--stage | --work | --keep] [-q] [<commit>]\n \n DESCRIPTION\n -----------\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex c40987e..8d6d9a1 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -23,7 +23,7 @@\n \n static const char * const git_reset_usage[] = {\n \tN_(\"git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]\"),\n-\tN_(\"git reset [--stage | --work] [-q] [<commit>]\"),\n+\tN_(\"git reset [--stage | --work | --keep] [-q] [<commit>]\"),\n \tN_(\"git reset [-q] <tree-ish> [--] <paths>...\"),\n \tN_(\"git reset --patch [<tree-ish>] [--] [<paths>...]\"),\n \tNULL\n@@ -306,8 +306,15 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (stage >= 0 || working_tree >= 0) {\n-\t\tif (reset_type != NONE)\n+\t\tint keep = 0;\n+\n+\t\tif (reset_type == KEEP) {\n+\t\t\tif (working_tree == 1)\n+\t\t\t\tdie(_(\"--keep is incompatible with --work\"));\n+\t\t\tkeep = 1;\n+\t\t} else if (reset_type != NONE) {\n \t\t\tdie(_(\"--{stage,work} are incompatible with --{hard,mixed,soft,merge}\"));\n+\t\t}\n \n \t\tif (working_tree == 1) {\n \t\t\tif (stage == 0)\n@@ -315,7 +322,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)\n \t\t\treset_type = HARD;\n \t\t} else {\n \t\t\tif (stage == 1)\n-\t\t\t\treset_type = NONE;\n+\t\t\t\treset_type = keep ? KEEP : NONE;\n \t\t\telse\n \t\t\t\treset_type = SOFT;\n \t\t}\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239684","messageId":"1398449567-16314-15-git-send-email-felipe.contreras@gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v2 try2 14/14] completion: update 'git reset' new stage options","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-25T18:12:47Z","receivedAt":"2014-04-25T18:12:47Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 52d83f2..e9b793b 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2248,7 +2248,8 @@ _git_reset ()\n \n \tcase \"$cur\" in\n \t--*)\n-\t\t__gitcomp \"--merge --mixed --hard --soft --patch\"\n+\t\t__gitcomp \"--merge --mixed --hard --soft --patch --keep --merge\n+\t\t\t--stage --no-stage --work --no-work\"\n \t\treturn\n \t\t;;\n \tesac\n-- \n1.9.2+fc1.2.gfbaae8c\n"},{"id":"239736","messageId":"CAE1pOi23ygoCJcGWYzYqa-JTOP5kSn9Bj1QByzUKrHTcvJ0fhg@mail.gmail.com","threadId":"36496","inReplyTo":"1398449567-16314-1-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v2 try2 00/14] Officially start moving to the term 'staging area'","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2014-04-26T01:33:11Z","receivedAt":"2014-04-26T01:33:11Z","isPatch":true,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 25 April 2014 11:12, Felipe Contreras <felipe.contreras@gmail.com> wrote:\n> It has been discussed many times in the past that 'index' is not an\n> appropriate description for what the high-level user does with it, and\n> it has been agreed that 'staging area' is the best term.\n>\n> The term 'staging area' is more intuitive for newcomers which are more\n> familiar with English than with Git, and it seems to be a\n> straightforward mental notion for people with different mother tongues.\n>\n> In fact it is so intuitive that it's used already in a lot online\n> documentation, and the people that do teach Git professionally use this\n> term, because it's easier for many kinds of audiences to grasp.\n\nWhile the implementation looks okay to me, I will not pretend to be a\ngood judge of that so I will leave that to others. But I definitely\nwelcome the API change this produces.\n"}]}