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

  • SEARCH
  • Home
  • 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 6222411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:18:33+00:00 2026-05-24T08:18:33+00:00

git newbie here, bear with me if this is trivial. I cannot find this

  • 0

git newbie here, bear with me if this is trivial. I cannot find this in some git basic docs seen so far.

I did a “git add file1” which puts the file into the index. Immediately after this the “git diff –cahced” shows correct diff content.

Then I made some more changes to file1. Now “git diff –cached” shows the previously shown diff content, and new changes are not being displayed. This makes me believe that the index is having the snapshot of the file1 contents when I did the “git add”, in other words, when I staged the file.

Is this correct? And will subsequent commit will only commit what “git diff –cached” is showing me, or all my changes till the commit is issued?

  • 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-24T08:18:33+00:00Added an answer on May 24, 2026 at 8:18 am

    That’s the whole point of index – it contains changes to be commited. If you don’t use -a, git commit will create a commit whose content (the tree) will be what was in the index.

    What git add does is that is copies the file (or directory) from the working copy into the index.

    One way this can be useful is git add -p: it lets you see changes to a file and adds a version of the file with only changes you chose to the index.

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

Sidebar

Related Questions

I am newbie with git. It tried this tutorial, but after the command, i
Git newbie here. I am probably making a simple mistake here, but I can't
GitHub Users, I am newbie on github and have some issue with git setup.
git remote add joyent yourname.no.de:repo I'm assuming that this means it is using the
I am a SCM newbie, but I just need some basic things for version
Git newbie here. Is there a way to synchronize two repositories, so that the
This is a pretty simple question: as a Git newbie I was wondering if
I'm a newbie in using git version control, I got this error when running
Hey, so I'm a complete git newbie here, the most advanced thing I've done
I'm a git newbie, and this is what I currently have: master: A --

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.