Re: How to list files that are pending for commit from a merge, including hand modified files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx> 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
>
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux