{"thread":{"id":"14866","subject":"Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","startedAt":"2008-08-06T21:22:00Z","lastAt":"2008-08-07T12:24:20Z","messageCount":10,"participants":["Jonathan Nieder","Miklos Vajna","Johannes Schindelin","J. Bruce Fields","Peter Krefting"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"86373","messageId":"Pine.GSO.4.62.0808061603340.18817@harper.uchicago.edu","threadId":"14866","inReplyTo":null,"subject":"Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-06T21:22:00Z","receivedAt":"2008-08-06T21:22:00Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"\"git commit -a\" ignores untracked files and follows all tracked\nfiles, regardless of whether they are listed in .gitignore.  So\ndon't use it to motivate gitignore.\n\nSigned-off-by: Jonathan Nieder <jrnieder@uchicago.edu>\n---\n\tI noticed this while reading through the git-scm book, which\n\tlooks very good.  If I am missing something, I would be very\n\thappy to know.  Maybe the sort of person that wants to track the\n\texact contents of the working tree would prefer\n\t\"git commit -a -i .\" over \"git commit -a\"?\n\n Documentation/user-manual.txt |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\nindex 43f4e39..f421689 100644\n--- a/Documentation/user-manual.txt\n+++ b/Documentation/user-manual.txt\n@@ -1128,8 +1128,8 @@ This typically includes files generated by a build process or temporary\n backup files made by your editor. Of course, 'not' tracking files with git\n is just a matter of 'not' calling \"`git-add`\" on them. But it quickly becomes\n annoying to have these untracked files lying around; e.g. they make\n-\"`git add .`\" and \"`git commit -a`\" practically useless, and they keep\n-showing up in the output of \"`git status`\".\n+\"`git add .`\" practically useless, and they keep showing up in the output of\n+\"`git status`\".\n \n You can tell git to ignore certain files by creating a file called .gitignore\n in the top level of your working directory, with contents such as:\n-- \n1.6.0.rc1.228.ge730\n"},{"id":"86375","messageId":"20080806214747.GY32057@genesis.frugalware.org","threadId":"14866","inReplyTo":"Pine.GSO.4.62.0808061603340.18817@harper.uchicago.edu","subject":"Re: Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-08-06T21:47:47Z","receivedAt":"2008-08-06T21:47:47Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Wed, Aug 06, 2008 at 04:22:00PM -0500, Jonathan Nieder <jrnieder@uchicago.edu> wrote:\n> \thappy to know.  Maybe the sort of person that wants to track the\n> \texact contents of the working tree would prefer\n> \t\"git commit -a -i .\" over \"git commit -a\"?\n\nIf you want so, then probably git add -A && git commit is easier.\n"},{"id":"86379","messageId":"Pine.GSO.4.62.0808061725450.21683@harper.uchicago.edu","threadId":"14866","inReplyTo":"20080806214747.GY32057@genesis.frugalware.org","subject":"Re: Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-06T22:29:58Z","receivedAt":"2008-08-06T22:29:58Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Miklos Vajna wrote:\n\n> On Wed, Aug 06, 2008 at 04:22:00PM -0500, Jonathan Nieder <jrnieder@uchicago.edu> wrote:\n> > \thappy to know.  Maybe the sort of person that wants to track the\n> > \texact contents of the working tree would prefer\n> > \t\"git commit -a -i .\" over \"git commit -a\"?\n> \n> If you want so, then probably git add -A && git commit is easier.\n\nHmm.  I don't want it myself, but it seemed like the spirit behind\nthe lines I mentioned in the user manual.  Maybe something like this\n(untested) would serve such people even better.\n\nIf anyone actually wants this, I'd be glad to make tests and document\nit.  Thanks for the pointer.\n\n-- snipsnip --\nSubject: git commit --addremove: add and update all files\n\nThis makes git commit -A a shortcut for git add -A && git commit.  It\nsaves keystrokes, but more importantly it seems to be conceptually the\nright thing thing for users who have perfect .gitignore files and want\nto ignore the index.\n---\n builtin-commit.c |   18 +++++++++++++++---\n 1 files changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex b783e6e..e3f645e 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -50,7 +50,8 @@ static char *logfile, *force_author;\n static const char *template_file;\n static char *edit_message, *use_message;\n static char *author_name, *author_email, *author_date;\n-static int all, edit_flag, also, interactive, only, amend, signoff;\n+static int all, addremove, edit_flag, also, interactive, only;\n+static int amend, signoff;\n static int quiet, verbose, no_verify, allow_empty;\n static char *untracked_files_arg;\n /*\n@@ -99,6 +100,7 @@ static struct option builtin_commit_options[] = {\n \n \tOPT_GROUP(\"Commit contents options\"),\n \tOPT_BOOLEAN('a', \"all\", &all, \"commit all changed files\"),\n+\tOPT_BOOLEAN('A', \"addremove\", &addremove, \"commit all changed files, including untracked\"),\n \tOPT_BOOLEAN('i', \"include\", &also, \"add specified files to index for commit\"),\n \tOPT_BOOLEAN(0, \"interactive\", &interactive, \"interactively add files\"),\n \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n@@ -788,8 +790,8 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \t\t\tfree(enc);\n \t}\n \n-\tif (!!also + !!only + !!all + !!interactive > 1)\n-\t\tdie(\"Only one of --include/--only/--all/--interactive can be used.\");\n+\tif (!!also + !!only + !!all + !!addremove + !!interactive > 1)\n+\t\tdie(\"Only one of --include/--only/--all/--addremove/--interactive can be used.\");\n \tif (argc == 0 && (also || (only && !amend)))\n \t\tdie(\"No paths with --include/--only does not make sense.\");\n \tif (argc == 0 && only && amend)\n@@ -823,6 +825,16 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \telse if (interactive && argc > 0)\n \t\tdie(\"Paths with --interactive does not make sense.\");\n \n+\tif (addremove) {\n+\t\tall = 1;\n+\t\talso = 1;\n+\t}\n+\tif (addremove && !argc) {\n+\t\tstatic const char *here[2] = {\".\", NULL };\n+\t\targc = 1;\n+\t\t*argv = here;\n+\t}\n+\n \treturn argc;\n }\n \n-- \n1.6.0.rc1.228.ge730\n"},{"id":"86380","messageId":"Pine.GSO.4.62.0808061753420.22639@harper.uchicago.edu","threadId":"14866","inReplyTo":"Pine.GSO.4.62.0808061725450.21683@harper.uchicago.edu","subject":"Re: Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-06T22:54:54Z","receivedAt":"2008-08-06T22:54:54Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"On Wed, 6 Aug 2008, Jonathan Nieder wrote:\n\n> Subject: git commit --addremove: add and update all files\n> \n> This makes git commit -A a shortcut for git add -A && git commit.  It\n> saves keystrokes, but more importantly it seems to be conceptually the\n> right thing thing for users who have perfect .gitignore files and want\n> to ignore the index.\n> ---\n>  builtin-commit.c |   18 +++++++++++++++---\n>  1 files changed, 15 insertions(+), 3 deletions(-)\n\nI was too hasty - the patch is insane in a number of ways.  But hopefully\nthe intent is clear :)\n\nJonathan\n"},{"id":"86382","messageId":"Pine.GSO.4.62.0808061906490.24977@harper.uchicago.edu","threadId":"14866","inReplyTo":"Pine.GSO.4.62.0808061725450.21683@harper.uchicago.edu","subject":"[PATCH] Documentation: clarify that git-commit only works with tracked files","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-07T00:15:35Z","receivedAt":"2008-08-07T00:15:35Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"A user unfamiliar with CVS might not realize that a git-add is\nneeded before commiting new files.  So emphasize that \"git commit\n<path>...\" only commits files already in the index.\n\nSigned-off-by: Jonathan Nieder <jrnieder@uchicago.edu>\n---\n\tI keep on forgetting and getting annoyed when \"git commit\n\tnewfile.c\" does not work.  From the same confusion I suggested\n\tgit commit -A without really thinking about what it meant.\n\tThis change should make the behavior easier to understand\n\tand remember.  Thanks for the help.\n\n Documentation/git-commit.txt |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 0e25bb8..9b00ccb 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -27,9 +27,10 @@ The content to be added can be specified in several ways:\n 2. by using 'git-rm' to remove files from the working tree\n    and the index, again before using the 'commit' command;\n \n-3. by listing files as arguments to the 'commit' command, in which\n-   case the commit will ignore changes staged in the index, and instead\n-   record the current content of the listed files;\n+3. by listing some known files as arguments to the 'commit'\n+   command, in which case the commit will ignore changes staged\n+   in the index and instead record the current content of the\n+   listed files;\n \n 4. by using the -a switch with the 'commit' command to automatically\n    \"add\" changes from all known files (i.e. all files that are already\n-- \n1.6.0.rc1.91.gf0c3\n"},{"id":"86387","messageId":"alpine.DEB.1.00.0808070239120.9611@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"14866","inReplyTo":"Pine.GSO.4.62.0808061906490.24977@harper.uchicago.edu","subject":"Re: [PATCH] Documentation: clarify that git-commit only works with tracked files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-08-07T00:39:59Z","receivedAt":"2008-08-07T00:39:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 6 Aug 2008, Jonathan Nieder wrote:\n\n> A user unfamiliar with CVS might not realize that a git-add is\n> needed before commiting new files.\n\nFunny.  I haven't used CVS for a while now, but I seem to remember that \n\"cvs commit newfile.c\" without a prior \"cvs add newfile.c\" is not allowed.\n\nCiao,\nDscho\n"},{"id":"86388","messageId":"Pine.GSO.4.62.0808062012260.26972@harper.uchicago.edu","threadId":"14866","inReplyTo":"alpine.DEB.1.00.0808070239120.9611@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: [PATCH] Documentation: clarify that git-commit only works with tracked files","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-07T01:14:52Z","receivedAt":"2008-08-07T01:14:52Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nOn Thu, 7 Aug 2008, Johannes Schindelin wrote:\n\n> On Wed, 6 Aug 2008, Jonathan Nieder wrote:\n> \n> > A user unfamiliar with CVS might not realize that a git-add is\n> > needed before commiting new files.\n> \n> Funny.  I haven't used CVS for a while now, but I seem to remember that \n> \"cvs commit newfile.c\" without a prior \"cvs add newfile.c\" is not allowed.\n\nYes, this is a closely related statement: a user familiar with CVS should\nalready know to add. :)\n\nJonathan\n"},{"id":"86409","messageId":"20080807110012.GB32057@genesis.frugalware.org","threadId":"14866","inReplyTo":"alpine.DEB.1.00.0808070239120.9611@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: [PATCH] Documentation: clarify that git-commit only works with tracked files","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-08-07T11:00:12Z","receivedAt":"2008-08-07T11:00:12Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Thu, Aug 07, 2008 at 02:39:59AM +0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Funny.  I haven't used CVS for a while now, but I seem to remember that \n> \"cvs commit newfile.c\" without a prior \"cvs add newfile.c\" is not allowed.\n\nBut there is a difference. In most VCSes, you need 'add' once. In git\nyou need add before every commit. Of course this should be clear after\nreading the \"How to make a commit\" part of the user manual.\n"},{"id":"86407","messageId":"Pine.LNX.4.64.0808071250530.2808@ds9.cixit.se","threadId":"14866","inReplyTo":"alpine.DEB.1.00.0808070239120.9611@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: [PATCH] Documentation: clarify that git-commit only works with tracked files","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2008-08-07T11:52:02Z","receivedAt":"2008-08-07T11:52:02Z","isPatch":true,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Johannes Schindelin:\n\n> Funny.  I haven't used CVS for a while now, but I seem to remember\n> that \"cvs commit newfile.c\" without a prior \"cvs add newfile.c\" is\n> not allowed.\n\nOnly to add the file to revision control initially. After that, you\njust use commit to create new revisions.\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"86404","messageId":"20080807122420.GA16343@fieldses.org","threadId":"14866","inReplyTo":"Pine.GSO.4.62.0808061603340.18817@harper.uchicago.edu","subject":"Re: Documentation: user-manual: \"git commit -a\" doesn't motivate .gitignore","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2008-08-07T12:24:20Z","receivedAt":"2008-08-07T12:24:20Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Wed, Aug 06, 2008 at 04:22:00PM -0500, Jonathan Nieder wrote:\n> \"git commit -a\" ignores untracked files and follows all tracked\n> files, regardless of whether they are listed in .gitignore.  So\n> don't use it to motivate gitignore.\n\nMakes sense to me.\n\n--b.\n\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>\n> ---\n> \tI noticed this while reading through the git-scm book, which\n> \tlooks very good.  If I am missing something, I would be very\n> \thappy to know.  Maybe the sort of person that wants to track the\n> \texact contents of the working tree would prefer\n> \t\"git commit -a -i .\" over \"git commit -a\"?\n> \n>  Documentation/user-manual.txt |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\n> index 43f4e39..f421689 100644\n> --- a/Documentation/user-manual.txt\n> +++ b/Documentation/user-manual.txt\n> @@ -1128,8 +1128,8 @@ This typically includes files generated by a build process or temporary\n>  backup files made by your editor. Of course, 'not' tracking files with git\n>  is just a matter of 'not' calling \"`git-add`\" on them. But it quickly becomes\n>  annoying to have these untracked files lying around; e.g. they make\n> -\"`git add .`\" and \"`git commit -a`\" practically useless, and they keep\n> -showing up in the output of \"`git status`\".\n> +\"`git add .`\" practically useless, and they keep showing up in the output of\n> +\"`git status`\".\n>  \n>  You can tell git to ignore certain files by creating a file called .gitignore\n>  in the top level of your working directory, with contents such as:\n> -- \n> 1.6.0.rc1.228.ge730\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}