I quote a git tutorial:
git diff shows the diff between HEAD and the current project state
I wonder what that means. Isn't the HEAD the current active project?
Thanks
I quote a git tutorial:
git diff shows the diff between HEAD and the current project state
I wonder what that means. Isn't the HEAD the current active project?
Thanks
git diff
is for showing the uncommitted changes (ie, the work that you have done but have not yet committed to the current project).
Here's a full explanation: http://www.kernel.org/pub/software/scm/git/docs/git-diff.html
From "Specifying revisions"
HEAD
names the commit your changes in the working tree is based.
There are other heads (FETCH_HEAD
, ORIG_HEAD
and MERGE_HEAD
). See Jefromi's answer for more.
The thing is, by default git diff
actually shows the differences between "the current state of your project" (i.e. your files on your working tree) and the index (not HEAD).
In other words, the differences are what you could tell git to further add to the index but you still haven't.
if you do git diff --cache
, then it will compare the index with HEAD.
See git book for more:
$ git diff
which will show you changes in the working directory that are not yet staged for the next commit. If you want to see what is staged for the next commit, you can run
$ git diff --cached
which will show you the difference between the index and your last commit; what you would be committing if you run "git commit" without the "-a" option. Lastly, you can run
$ git diff HEAD
which shows changes in the working directory since your last commit; what you would be committing if you run "git co