Re: git-diff new files (without using index)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Miles Bader <miles@...>
Cc: <git@...>
Date: Saturday, August 4, 2007 - 11:52 pm

Miles Bader <miles@gnu.org> wrote:
 
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-diff new files (without using index), Miles Bader, (Sat Aug 4, 11:42 pm)
Re: git-diff new files (without using index), Shawn O. Pearce, (Sat Aug 4, 11:52 pm)
Re: git-diff new files (without using index), Miles Bader, (Sun Aug 5, 12:00 am)
Re: git-diff new files (without using index), Shawn O. Pearce, (Sun Aug 5, 12:08 am)
Re: git-diff new files (without using index), Junio C Hamano, (Sun Aug 5, 12:20 am)
Re: git-diff new files (without using index), Miles Bader, (Sun Aug 5, 12:37 am)