git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fyn Fynn" <fynfynn@gmail.com>
To: git@vger.kernel.org
Subject: Re: Fwd: git status options feature suggestion
Date: Fri, 17 Oct 2008 17:19:47 -0700	[thread overview]
Message-ID: <1a04eebf0810171719r6b604a88n781bf43f0f047aae@mail.gmail.com> (raw)
In-Reply-To: <ee2a733e0810120309o1fbfa4dxe6f2292a28bd6db3@mail.gmail.com>

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

  reply	other threads:[~2008-10-18  0:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-12 10:09 Fwd: git status options feature suggestion Leo Razoumov
2008-10-18  0:19 ` Fyn Fynn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-09  5:34 Caleb Cushing
2008-10-09  6:11 ` Jeff King
     [not found]   ` <81bfc67a0810082327p421ca4e9v84f4b33023bc6fe6@mail.gmail.com>
2008-10-09  6:27     ` Fwd: " Caleb Cushing
2008-10-09  9:03       ` Johannes Schindelin
2008-10-09 15:12         ` Michael J Gruber
2008-10-10  2:20           ` Caleb Cushing
2008-10-10  4:25           ` Elijah Newren
2008-10-10 11:13           ` Johannes Schindelin
2008-10-12  4:49           ` Jeff King
2008-10-12  6:41             ` Junio C Hamano
2008-10-12  6:45               ` Jeff King
2008-10-12  8:10                 ` Junio C Hamano
2008-10-13  1:04                   ` Jeff King
2008-10-13  1:30                     ` Shawn O. Pearce
2008-10-26  1:47                   ` Junio C Hamano
2008-10-26  4:59                     ` Jeff King
2008-10-12 18:05                 ` Shawn O. Pearce
2008-10-13  1:06                   ` Jeff King
2008-10-12  9:07               ` Jakub Narebski
2008-10-12  8:26             ` Jeff King
2008-10-12  9:58               ` Junio C Hamano
2008-10-13  0:59                 ` Jeff King

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=1a04eebf0810171719r6b604a88n781bf43f0f047aae@mail.gmail.com \
    --to=fynfynn@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).