git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Brent Goodrick <bgoodr@gmail.com>
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 15:29:23 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0902211523280.3111@localhost.localdomain> (raw)
In-Reply-To: <e38bce640902211520j3f3c2787y28640b0ebcba5e27@mail.gmail.com>



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

  reply	other threads:[~2009-02-21 23:31 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 [this message]
2009-02-22  2:09   ` Brent Goodrick

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=alpine.LFD.2.00.0902211523280.3111@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=bgoodr@gmail.com \
    --cc=git@vger.kernel.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).