From: Brent Goodrick <bgoodr@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: git@vger.kernel.org
Subject: Re: How to list files that are pending for commit from a merge, including hand modified files
Date: Sat, 21 Feb 2009 18:09:59 -0800 [thread overview]
Message-ID: <e38bce640902211809u70c0de2el96a2df0238bc671@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0902211523280.3111@localhost.localdomain>
Thanks very much! I'll have to play around with those variations a
bit to get a feel for what will work in my context.
bg
On Sat, Feb 21, 2009 at 3:29 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
>
> On Sat, 21 Feb 2009, Brent Goodrick wrote:
>>
>> Is there some way in which to get a listing of the files that git-status
>> shows in its "changes to be committed" section, but not the "Untracked
>> files" section, short of postprocessing the git-status output with
>> sed/awk gymnastics?
>
> Just do variations on
>
> git diff --name-only HEAD
>
> and the reason I say "variations on" is that depending on exactly what you
> want you may want to use slightly different diffs.
>
> For example, the command line above will list all files that are changed
> in the working tree wrt HEAD. But if you want to see only the files that
> you have actually updated in the index (ie the ones that would be
> committed without using "-a"), you should add "--cached" to the command
> line, so that it does the diff from HEAD to index, not HEAD to working
> tree.
>
> And if you want to see what files are different in the working tree from
> the index, then drop the "HEAD" part, since that's the default behavior
> for "git diff".
>
> Finally, use "--name-status" if you want to see if they are new, modified,
> or deleted - rather than just the name.
>
> And if you care about renames, and want to see them as such, use -C or -M,
> of course.
>
> So "git ls-files" is not at all what you want. That will give you
> information about the current index, but doesn't talk at all about how it
> differs from the previous commit or from the working tree. It can be
> useful for another thing, though: if you're in the middle of a merge, then
> you can ask for which files are marked as being unmerged in the index.
>
> Linus
>
prev parent reply other threads:[~2009-02-22 2:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-21 23:20 How to list files that are pending for commit from a merge, including hand modified files Brent Goodrick
2009-02-21 23:29 ` Linus Torvalds
2009-02-22 2:09 ` Brent Goodrick [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e38bce640902211809u70c0de2el96a2df0238bc671@mail.gmail.com \
--to=bgoodr@gmail.com \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).