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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:55:23+00:00 2026-05-24T22:55:23+00:00

After I made a commit, I want to clean the stage area. Here is

  • 0

After I made a commit, I want to clean the stage area. Here is what I did:

git add 1.txt    ----- stage the 1.txt file
git commit -m "commit 1.txt"  ----- commit the 1.txt file
git reset HEAD 1.txt   ----- I want to clean the stage area

Then I check the stage area with this command:

git ls-files

The 1.txt is still shown.

Why?

  • 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-24T22:55:24+00:00Added an answer on May 24, 2026 at 10:55 pm

    Short answer:

    Your staging is clean, atleast wrt HEAD if not the working directory too, once you commit.

    Long answer:

    You have committed the file 1.txt. When you commit the index (staging) and HEAD become the same. And when you do git reset HEAD 1.txt, it is basically a noop, as both index and HEAD have the same version of 1.txt.

    And git ls-files will display 1.txt because the file is in your repo.

    Not really sure what you are trying to do. But once you have committed a file, you can unstage the modifications you have done to it. In the case of a newly added file, unstaging the modifications is the same as removing the newly added file from index and hence unstaging it. But that is not the same for a file already in the repo.

    Ideal way to remove file from staging, is git rm --cached – and when you commit, you remove the file from the repo as well. Remember that staging is the view of what HEAD will be once you commit.

    But I think git rm --cached is not what you want to do as you just want a clean staging / index. After you commit it is clean anyway ( atleast wrt HEAD if not the working directory).

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

Sidebar

Related Questions

I made a solution to deploy a custom master page (a WSP file). After
After git init , I added and committed a few files, made some changes,
I want to make changes to a file in my repo, then force git
My post commit hook is not running after git. I have verified that the
Here are some git actions I performed. As you can see, I made a
I reverted to a previous commit and made some changes. Now I want to
I'm using Git's post-receive hook to send out an email after a commit has
I've made a few commits and now I want them (say from some commit
Is it possible to check if a (MySQL) database exists after having made a
I'm creating a Tic tac toe game, in that after click made by user

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.