Reputation: 16534
is there a git command to list the files that have been fully staged? I'm aware of git diff --name-only (with and without --cahced to see the unstaged/staged) but I'd like a list of files that are fully staged with no unstaged changes in them.
Upvotes: 1
Views: 112
Reputation: 80931
I believe you want git status --porcelain
for this.
git status --porcelain | grep '^[^ ] ' | cut -d ' ' -f 2
From the man page:
--porcelain
Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git
versions and regardless of user configuration. See below for details.
Also the Short Format
and Porcelain Format
sections later in the document.
Upvotes: 1
Reputation: 14843
Use the comm program to filter the output of the file lists from the staging area and the working directory.
comm -23 <(git diff --cached --name-only) <(git diff --name-only)
And then alias it to git fully-staged
or something if you want.
Upvotes: 3