* Newbie question: how can I list added files?
@ 2010-06-23 17:31 Bruce Korb
2010-06-23 17:43 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Bruce Korb @ 2010-06-23 17:31 UTC (permalink / raw)
To: GIT List
git-ls-files doesn't seem to have an option for it,
neither does git-add. Seems like it ought to be
trivial, but I'm not seeing how to do it. :( Thank you!!
P.S.: yes, I know I can parse the output from git-status.
I'd really rather not for various reasons. If it's the only
way, then I'll do the only thing.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 17:31 Newbie question: how can I list added files? Bruce Korb
@ 2010-06-23 17:43 ` Junio C Hamano
2010-06-23 17:50 ` Bruce Korb
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2010-06-23 17:43 UTC (permalink / raw)
To: Bruce Korb; +Cc: GIT List
"git diff --name-only --diff-filter=A HEAD"?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 17:43 ` Junio C Hamano
@ 2010-06-23 17:50 ` Bruce Korb
2010-06-23 18:28 ` Junio C Hamano
2010-06-23 18:30 ` Jeff King
0 siblings, 2 replies; 9+ messages in thread
From: Bruce Korb @ 2010-06-23 17:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT List
On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
> "git diff --name-only --diff-filter=A HEAD"?
Thank you, but "Nope."
My added file doesn't show anything and not using the
"--diff-filter" thing shows both added and not added files:
$ git diff --name-only --diff-filter=A HEAD
$ git-status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sw/embedded/platform/strad/scripts/mk_relsrc.sh
[...]
$ git diff --name-only HEAD
chip/chopin2/up/hdl/.sopc_builder/install.ptf
chip/mozart/up_oam/hdl/.sopc_builder/install.ptf
chip/mozart2/up/hdl/.sopc_builder/install.ptf
chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf
sw/embedded/nios2/system/system.stf
sw/embedded/platform/strad/scripts/mk_relsrc.sh
sw/projects/nios2/modules/system/lib/system.stf
$
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 17:50 ` Bruce Korb
@ 2010-06-23 18:28 ` Junio C Hamano
2010-06-23 18:30 ` Jeff King
1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2010-06-23 18:28 UTC (permalink / raw)
To: Bruce Korb; +Cc: GIT List
Bruce Korb <bruce.korb@gmail.com> writes:
> $ git diff --name-only HEAD
> chip/chopin2/up/hdl/.sopc_builder/install.ptf
> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf
> chip/mozart2/up/hdl/.sopc_builder/install.ptf
> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf
> sw/embedded/nios2/system/system.stf
> sw/embedded/platform/strad/scripts/mk_relsrc.sh
> sw/projects/nios2/modules/system/lib/system.stf
Try using --name-status instead here and check what you see.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 17:50 ` Bruce Korb
2010-06-23 18:28 ` Junio C Hamano
@ 2010-06-23 18:30 ` Jeff King
2010-06-23 19:15 ` Bruce Korb
1 sibling, 1 reply; 9+ messages in thread
From: Jeff King @ 2010-06-23 18:30 UTC (permalink / raw)
To: Bruce Korb; +Cc: Junio C Hamano, GIT List
On Wed, Jun 23, 2010 at 10:50:11AM -0700, Bruce Korb wrote:
> On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
> > "git diff --name-only --diff-filter=A HEAD"?
>
> Thank you, but "Nope."
> My added file doesn't show anything and not using the
> "--diff-filter" thing shows both added and not added files:
>
> $ git diff --name-only --diff-filter=A HEAD
> $ git-status
> # On branch master
> # Changes to be committed:
> # (use "git reset HEAD <file>..." to unstage)
> #
> # modified: sw/embedded/platform/strad/scripts/mk_relsrc.sh
> [...]
> $ git diff --name-only HEAD
> chip/chopin2/up/hdl/.sopc_builder/install.ptf
> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf
> chip/mozart2/up/hdl/.sopc_builder/install.ptf
> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf
> sw/embedded/nios2/system/system.stf
> sw/embedded/platform/strad/scripts/mk_relsrc.sh
> sw/projects/nios2/modules/system/lib/system.stf
Usually when we say "added file", it means "a new file which has just
been added". Did you mean "a file which was modified, but whose contents
I have already added to the index"?
In that case, I think you just want:
git diff --cached --name-only
to see files that differ between the index and HEAD (i.e., things which
will be committed).
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 18:30 ` Jeff King
@ 2010-06-23 19:15 ` Bruce Korb
2010-06-23 19:52 ` Eric Raible
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Bruce Korb @ 2010-06-23 19:15 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, GIT List
On Wed, Jun 23, 2010 at 11:30 AM, Jeff King <peff@peff.net> wrote:
> On Wed, Jun 23, 2010 at 10:50:11AM -0700, Bruce Korb wrote:
>
>> On Wed, Jun 23, 2010 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> > "git diff --name-only --diff-filter=A HEAD"?
>>
>> Thank you, but "Nope."
>> My added file doesn't show anything and not using the
>> "--diff-filter" thing shows both added and not added files:
>>
>> $ git diff --name-only --diff-filter=A HEAD
>> $ git-status
>> # On branch master
>> # Changes to be committed:
>> # (use "git reset HEAD <file>..." to unstage)
>> #
>> # modified: sw/embedded/platform/strad/scripts/mk_relsrc.sh
>> [...]
>> $ git diff --name-only HEAD
>> chip/chopin2/up/hdl/.sopc_builder/install.ptf
>> chip/mozart/up_oam/hdl/.sopc_builder/install.ptf
>> chip/mozart2/up/hdl/.sopc_builder/install.ptf
>> chip/mozart2/up_ft/hdl/.sopc_builder/install.ptf
>> sw/embedded/nios2/system/system.stf
>> sw/embedded/platform/strad/scripts/mk_relsrc.sh
>> sw/projects/nios2/modules/system/lib/system.stf
Hello,
"--name-status" just adds "M" in front of that list.
> Usually when we say "added file", it means "a new file which has just
> been added". Did you mean "a file which was modified, but whose contents
> I have already added to the index"?
I mean a file that was "git add"-ed and thus is now staged.
One would first guess that "git-ls-files --stage" would get what I want,
but no, it lists every file in the repo. Not what I need.
> In that case, I think you just want:
>
> git diff --cached --name-only
>
> to see files that differ between the index and HEAD (i.e., things which
> will be committed).
*YES* That *IS* what I want. Thank you!!! Regards, Bruce
P.S. Is it really so rare that someone would want this info that it should
wind up being so obscure? I now have a new alias:
alias git-ls-staged="git diff --cached --name-only"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 19:15 ` Bruce Korb
@ 2010-06-23 19:52 ` Eric Raible
2010-06-23 19:55 ` Tomas Carnecky
2010-06-23 20:04 ` Andreas Schwab
2 siblings, 0 replies; 9+ messages in thread
From: Eric Raible @ 2010-06-23 19:52 UTC (permalink / raw)
To: git
Bruce Korb <bruce.korb <at> gmail.com> writes:
> P.S. Is it really so rare that someone would want this info that it should
> wind up being so obscure? I now have a new alias:
>
> alias git-ls-staged="git diff --cached --name-only"
Both: gitk and "git gui" show this quite clearly.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 19:15 ` Bruce Korb
2010-06-23 19:52 ` Eric Raible
@ 2010-06-23 19:55 ` Tomas Carnecky
2010-06-23 20:04 ` Andreas Schwab
2 siblings, 0 replies; 9+ messages in thread
From: Tomas Carnecky @ 2010-06-23 19:55 UTC (permalink / raw)
To: Bruce Korb; +Cc: GIT List
On 6/23/10 9:15 PM, Bruce Korb wrote:
> P.S. Is it really so rare that someone would want this info that it should
> wind up being so obscure? I now have a new alias:
>
> alias git-ls-staged="git diff --cached --name-only"
Did you know git has a builtin support for aliases?
$ git config --global alias.ls-staged "diff --cached --name-only"
tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Newbie question: how can I list added files?
2010-06-23 19:15 ` Bruce Korb
2010-06-23 19:52 ` Eric Raible
2010-06-23 19:55 ` Tomas Carnecky
@ 2010-06-23 20:04 ` Andreas Schwab
2 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2010-06-23 20:04 UTC (permalink / raw)
To: Bruce Korb; +Cc: Jeff King, Junio C Hamano, GIT List
Bruce Korb <bruce.korb@gmail.com> writes:
> alias git-ls-staged="git diff --cached --name-only"
Or: git config alias.ls-staged "diff --cached --name-only"
(Perhaps add --global.)
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-06-23 20:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 17:31 Newbie question: how can I list added files? Bruce Korb
2010-06-23 17:43 ` Junio C Hamano
2010-06-23 17:50 ` Bruce Korb
2010-06-23 18:28 ` Junio C Hamano
2010-06-23 18:30 ` Jeff King
2010-06-23 19:15 ` Bruce Korb
2010-06-23 19:52 ` Eric Raible
2010-06-23 19:55 ` Tomas Carnecky
2010-06-23 20:04 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).