Use a temporary index:
(export GIT_INDEX_FILE=.git/tempindex;
cp .git/index $GIT_INDEX_FILE;
git add new-file;
git add other-new-file;
git diff --cached)
We pull this trick sometimes in internal tools, when we want to
produce some result but aren't sure we want to keep the resulting
index, or really know we don't want to keep the resulting index.
Another option is to just add everything, then reset the index:
git add new-file
git add other-new-file
git diff --cached
git reset
Granted if you had other files staged they just became unstaged
and will need to be restaged... the temporary index trick above
avoids that.
--
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html