Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 938307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:37:19+00:00 2026-05-15T21:37:19+00:00

I quote a git tutorial: git diff shows the diff between HEAD and the

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:37:20+00:00Added an answer on May 15, 2026 at 9:37 pm

    From “Specifying revisions“

    HEAD names the commit on which you based the changes in the working tree.

    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 --cached, then it will compare the index with HEAD.

    See git book for more (archive link):

    A common use is to simply run

    $ 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. (In Git versions 1.6.1 and later, you can also use git diff --staged which may be easier to remember.) 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 commit -a”.

    See also 365git: Getting a diff between the working tree and other commits:

    http://images.abizern.org.s3.amazonaws.com/365git/Feb11/Git%20Diff%202.png

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a getStockQuote() function that will get a current stock quote for a
Quote from Head first html: You can add padding to the top and bottom
Unfortunately I did several times git reset --hard HEAD^ losing a quite big chunk
I am following the quite-easy-to-understand Git Immersion tutorial to get started, as am using
I have been wanting to use a git command that saves a stash without
I'm having difficulty getting Git to cooperate with my user-defined worktree that exists outside
I am quite new in git, and I have seen that it is possible
Sometimes git suggests git rm --cached to unstage a file, sometimes git reset HEAD
Is there a definitive list of commands anywhere that cause git gc --auto to
Our project has been using Git for a week or so now, and we're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.