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 6124249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:06:40+00:00 2026-05-23T16:06:40+00:00

The git book defines the git index: The Git index is used as a

  • 0

The git book defines the git index:

The Git index is used as a staging
area between your working directory
and your repository. You can use the
index to build up a set of changes
that you want to commit together. When
you create a commit, what is committed
is what is currently in the index, not
what is in your working directory
.

But I am still having a difficult time understanding it, especially the highlighted statement that “what’s committed is not what’s in my working directory”.

So far, in my limited working with git, everything in the working directory is always committed, if I do:

git add <all new files in the working directory>
git commit -a -m "git will refuse to commit without this comment" 

git then commits all modified files as well as all new files.

So, in effect, my working directory is the staging area?

I am not sure then what the git index is and how it is interpreted as the staging area.

Could you please explain?

  • 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-23T16:06:40+00:00Added an answer on May 23, 2026 at 4:06 pm

    The answer in your particular case is that you are understanding the documentation correctly, but using the “shortcut” command to commit your entire working directory.

    If you run git commit -a -m "Message" then your working directory is treated like it is the staging area. This is convenient sometimes, but you lose the ability to use the index as designed. Try the following command:

    git commit -m "Message"
    

    If you do this instead, you can use the staging area to commit only part of the changes you have made to your working directory.

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

Sidebar

Related Questions

I use git for my source management, I have a local repository on my
In the Git community book, it says Another interesting thing you can do is
Is there any documentation about internal structure of Git index file? From various book
Why on all images that show queue of commits in Pro Git book arrows
I've read the Basic Branching and Merging section of the Git Community Book. So
I've read this book section about git branches. I have create a branch called
Git has a much-touted(?) octopus-merge capability that can merge many heads into one. But
Git says to use git add to add untracked files to my repo. I
git diff master..lab It will produce the diff between the tips of the two
We use git (github) and capistrano (like 99% of the Rails shops out there)

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.