Re: Fwd: git status options feature suggestion

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

 



Just wanted to chime in about a feature existing in Bazaar's and
Subversion's and  "status" command: getting the status of tracked
files _only_.

Here's how the status -V switch works in Bazaar:

~/foo$ bzr init
~/foo$ echo "content" > bar.txt
~/foo$ bzr add bar.txt
added bar.txt
~/foo$ echo "content" > baz.txt
~/foo$ bzr status
added:
  bar.txt
unknown:
  baz.txt
~/foo$ bzr status -V
added:
  bar.txt

As you can see, the -V switch makes `bzr status` only display the
status of files that are tracked.

This is very useful when you're tracking a "skeleton" of essential
files in a directory tree that contains a large number of additional
files and subdirectories, particularly if those are changing often and
/ or are large/binary so it's impractical to control/ignore them.

A common case of that: tracking a subset of configuration files under
one's home directory.

Right now, there are two ways of getting around the lack of "status
-V" (Subversion: "status -q") in git (credit for both goes to doener
on #git@FreeNode, who showed them to me):

git config --global alias.st 'diff --name-status HEAD'

Which makes `git st` output practically the same thing as  -V/-q in
Bazaar/Subversion. However, the output doesn't distinguish between
Staged (indexed) and Unstaged (non-indexed) changes (a distinction
that the 2 other SCMs above don't support).


git config --global alias.st '!echo Staged:; git diff --cached
--name-status; echo Unstaged:; git diff --name-status'

Which does distinguish between Staged and Unstaged, but is definitely
something that can work only as an alias for frequent usage.

Incidentally, a minor quibble with both solutions is that they require
HEAD to exist; so you need to make at least one commit before you can
use them. For most users, this wouldn't frequently be a huge loss, but
if you're commonly initializing branches, you might miss it. For
example, note how the above Bazaar example would fail with:

fatal: ambiguous argument 'HEAD': unknown revision or path not in the
working tree.

- Fyn
--
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