{"thread":{"id":"24174","subject":"Newbie question: how can I list added files?","startedAt":"2010-06-23T17:31:07Z","lastAt":"2010-06-23T20:04:30Z","messageCount":9,"participants":["Bruce Korb","Junio C Hamano","Jeff King","Eric Raible","Andreas Schwab","Tomas Carnecky"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144080","messageId":"AANLkTinxOE5xcP_V-PvoZGlfsxtcCafoYKy_PuBZnQnQ@mail.gmail.com","threadId":"24174","inReplyTo":null,"subject":"Newbie question: how can I list added files?","fromName":"Bruce Korb","fromEmail":"bruce.korb@gmail.com","sentAt":"2010-06-23T17:31:07Z","receivedAt":"2010-06-23T17:31:07Z","isPatch":false,"sender":{"key":"bruce.korb@gmail.com","avatar":"https://gravatar.com/avatar/86d91467dc7cc8466a9d133a7b93a5d21233052017c144c9a6f6f7e5110344d0?d=mp&s=160"},"body":"git-ls-files doesn't seem to have an option for it,\nneither does git-add.  Seems like it ought to be\ntrivial, but I'm not seeing how to do it.  :(  Thank you!!\n\nP.S.:  yes, I know I can parse the output from git-status.\nI'd really rather not for various reasons.  If it's the only\nway, then I'll do the only thing.\n"},{"id":"144082","messageId":"7vzkylejbf.fsf@alter.siamese.dyndns.org","threadId":"24174","inReplyTo":"AANLkTinxOE5xcP_V-PvoZGlfsxtcCafoYKy_PuBZnQnQ@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-23T17:43:16Z","receivedAt":"2010-06-23T17:43:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"git diff --name-only --diff-filter=A HEAD\"?\n"},{"id":"144083","messageId":"AANLkTikE2ylLXk5XxNGvcvol6R-puSTzPurdLcNMYaZJ@mail.gmail.com","threadId":"24174","inReplyTo":"7vzkylejbf.fsf@alter.siamese.dyndns.org","subject":"Re: Newbie question: how can I list added files?","fromName":"Bruce Korb","fromEmail":"bruce.korb@gmail.com","sentAt":"2010-06-23T17:50:11Z","receivedAt":"2010-06-23T17:50:11Z","isPatch":false,"sender":{"key":"bruce.korb@gmail.com","avatar":"https://gravatar.com/avatar/86d91467dc7cc8466a9d133a7b93a5d21233052017c144c9a6f6f7e5110344d0?d=mp&s=160"},"body":"On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"git diff --name-only --diff-filter=A HEAD\"?\n\nThank you, but \"Nope.\"\nMy added file doesn't show anything and not using the\n\"--diff-filter\" thing shows both added and not added files:\n\n$ git diff --name-only --diff-filter=A HEAD\n$ git-status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       modified:   sw/embedded/platform/strad/scripts/mk_relsrc.sh\n[...]\n$ git diff --name-only HEAD\nchip/chopin2/up/hdl/.sopc_builder/install.ptf\nchip/mozart/up_oam/hdl/.sopc_builder/install.ptf\nchip/mozart2/up/hdl/.sopc_builder/install.ptf\nchip/mozart2/up_ft/hdl/.sopc_builder/install.ptf\nsw/embedded/nios2/system/system.stf\nsw/embedded/platform/strad/scripts/mk_relsrc.sh\nsw/projects/nios2/modules/system/lib/system.stf\n$\n"},{"id":"144085","messageId":"7vvd99eh8l.fsf@alter.siamese.dyndns.org","threadId":"24174","inReplyTo":"AANLkTikE2ylLXk5XxNGvcvol6R-puSTzPurdLcNMYaZJ@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-23T18:28:10Z","receivedAt":"2010-06-23T18:28:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bruce Korb <bruce.korb@gmail.com> writes:\n\n> $ git diff --name-only HEAD\n> chip/chopin2/up/hdl/.sopc_builder/install.ptf\n> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf\n> chip/mozart2/up/hdl/.sopc_builder/install.ptf\n> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf\n> sw/embedded/nios2/system/system.stf\n> sw/embedded/platform/strad/scripts/mk_relsrc.sh\n> sw/projects/nios2/modules/system/lib/system.stf\n\nTry using --name-status instead here and check what you see.\n"},{"id":"144086","messageId":"20100623183050.GA20842@coredump.intra.peff.net","threadId":"24174","inReplyTo":"AANLkTikE2ylLXk5XxNGvcvol6R-puSTzPurdLcNMYaZJ@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-06-23T18:30:50Z","receivedAt":"2010-06-23T18:30:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 23, 2010 at 10:50:11AM -0700, Bruce Korb wrote:\n\n> On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> > \"git diff --name-only --diff-filter=A HEAD\"?\n> \n> Thank you, but \"Nope.\"\n> My added file doesn't show anything and not using the\n> \"--diff-filter\" thing shows both added and not added files:\n> \n> $ git diff --name-only --diff-filter=A HEAD\n> $ git-status\n> # On branch master\n> # Changes to be committed:\n> #   (use \"git reset HEAD <file>...\" to unstage)\n> #\n> #       modified:   sw/embedded/platform/strad/scripts/mk_relsrc.sh\n> [...]\n> $ git diff --name-only HEAD\n> chip/chopin2/up/hdl/.sopc_builder/install.ptf\n> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf\n> chip/mozart2/up/hdl/.sopc_builder/install.ptf\n> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf\n> sw/embedded/nios2/system/system.stf\n> sw/embedded/platform/strad/scripts/mk_relsrc.sh\n> sw/projects/nios2/modules/system/lib/system.stf\n\nUsually when we say \"added file\", it means \"a new file which has just\nbeen added\". Did you mean \"a file which was modified, but whose contents\nI have already added to the index\"?\n\nIn that case, I think you just want:\n\n  git diff --cached --name-only\n\nto see files that differ between the index and HEAD (i.e., things which\nwill be committed).\n\n-Peff\n"},{"id":"144090","messageId":"AANLkTin-MEBUYheTkFbeKIBj5peVV-sPa7hZSg-wMgBi@mail.gmail.com","threadId":"24174","inReplyTo":"20100623183050.GA20842@coredump.intra.peff.net","subject":"Re: Newbie question: how can I list added files?","fromName":"Bruce Korb","fromEmail":"bruce.korb@gmail.com","sentAt":"2010-06-23T19:15:57Z","receivedAt":"2010-06-23T19:15:57Z","isPatch":false,"sender":{"key":"bruce.korb@gmail.com","avatar":"https://gravatar.com/avatar/86d91467dc7cc8466a9d133a7b93a5d21233052017c144c9a6f6f7e5110344d0?d=mp&s=160"},"body":"On Wed, Jun 23, 2010 at 11:30 AM, Jeff King <peff@peff.net> wrote:\n> On Wed, Jun 23, 2010 at 10:50:11AM -0700, Bruce Korb wrote:\n>\n>> On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> > \"git diff --name-only --diff-filter=A HEAD\"?\n>>\n>> Thank you, but \"Nope.\"\n>> My added file doesn't show anything and not using the\n>> \"--diff-filter\" thing shows both added and not added files:\n>>\n>> $ git diff --name-only --diff-filter=A HEAD\n>> $ git-status\n>> # On branch master\n>> # Changes to be committed:\n>> #   (use \"git reset HEAD <file>...\" to unstage)\n>> #\n>> #       modified:   sw/embedded/platform/strad/scripts/mk_relsrc.sh\n>> [...]\n>> $ git diff --name-only HEAD\n>> chip/chopin2/up/hdl/.sopc_builder/install.ptf\n>> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf\n>> chip/mozart2/up/hdl/.sopc_builder/install.ptf\n>> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf\n>> sw/embedded/nios2/system/system.stf\n>> sw/embedded/platform/strad/scripts/mk_relsrc.sh\n>> sw/projects/nios2/modules/system/lib/system.stf\n\nHello,\n\n\"--name-status\" just adds \"M\" in front of that list.\n\n> Usually when we say \"added file\", it means \"a new file which has just\n> been added\". Did you mean \"a file which was modified, but whose contents\n> I have already added to the index\"?\n\nI mean a file that was \"git add\"-ed and thus is now staged.\nOne would first guess that \"git-ls-files --stage\" would get what I want,\nbut no, it lists every file in the repo.  Not what I need.\n\n> In that case, I think you just want:\n>\n>  git diff --cached --name-only\n>\n> to see files that differ between the index and HEAD (i.e., things which\n> will be committed).\n\n*YES*  That *IS* what I want.  Thank you!!!  Regards, Bruce\n\nP.S. Is it really so rare that someone would want this info that it should\nwind up being so obscure?  I now have a new alias:\n\n   alias git-ls-staged=\"git diff --cached --name-only\"\n"},{"id":"144102","messageId":"loom.20100623T214603-16@post.gmane.org","threadId":"24174","inReplyTo":"AANLkTin-MEBUYheTkFbeKIBj5peVV-sPa7hZSg-wMgBi@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2010-06-23T19:52:05Z","receivedAt":"2010-06-23T19:52:05Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"Bruce Korb <bruce.korb <at> gmail.com> writes:\n\n> P.S. Is it really so rare that someone would want this info that it should\n> wind up being so obscure?  I now have a new alias:\n> \n>    alias git-ls-staged=\"git diff --cached --name-only\"\n\nBoth: gitk and \"git gui\" show this quite clearly.\n"},{"id":"144105","messageId":"4C2266B4.2060404@dbservice.com","threadId":"24174","inReplyTo":"AANLkTin-MEBUYheTkFbeKIBj5peVV-sPa7hZSg-wMgBi@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2010-06-23T19:55:32Z","receivedAt":"2010-06-23T19:55:32Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"On 6/23/10 9:15 PM, Bruce Korb wrote:\n> P.S. Is it really so rare that someone would want this info that it should\n> wind up being so obscure?  I now have a new alias:\n> \n>    alias git-ls-staged=\"git diff --cached --name-only\"\n\nDid you know git has a builtin support for aliases?\n  $ git config --global alias.ls-staged \"diff --cached --name-only\"\n\ntom\n"},{"id":"144103","messageId":"m2aaqlh5wx.fsf@igel.home","threadId":"24174","inReplyTo":"AANLkTin-MEBUYheTkFbeKIBj5peVV-sPa7hZSg-wMgBi@mail.gmail.com","subject":"Re: Newbie question: how can I list added files?","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-06-23T20:04:30Z","receivedAt":"2010-06-23T20:04:30Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Bruce Korb <bruce.korb@gmail.com> writes:\n\n>    alias git-ls-staged=\"git diff --cached --name-only\"\n\nOr: git config alias.ls-staged \"diff --cached --name-only\"\n\n(Perhaps add --global.)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"}]}