threads / discuss / 15866

Re: Fwd: git status options feature suggestion

Subject: Re: Fwd: git status options feature suggestion

## tl;dr

2 messages between Oct 12, 2008 and Oct 18, 2008.

replies: 1people: 2as markdown or json

Leo Razoumov· Oct 12, 2008, 10:09 UTC · lore
On 10/12/08, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> [..snip..]
> I was going to suggest the same.  "git st" for people who come from "svn st"
>  so that "git status" can be kept as traditional "preview of 'git commit'".
>
>  And just make it mimic whatever folks accustomed to "svn st" would expect,
>  modulo we would need two status letters to signal difference between
>  (HEAD, index), and (index, worktree).  Perhaps three if you want to show
>  difference between (HEAD, worktree) while at it.
>
>  And no, I have not seen any argument good enough to change ls-files nor
>  diff-$lowlevel output and break people's existing scripts.
>
Please, at least introduce a new option (--status-letters)  that makes

git log --name-status git diff --name-status git ls-files -v

to use consistent letters to indicate the status. For details, see recent discussion http://www.spinics.net/lists/git/msg81141.html

Thanks, --Leo--

Fyn Fynn· Oct 18, 2008, 00:19 UTC · re: Leo Razoumov · lore

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

← back to recent threads