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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:56:44+00:00 2026-06-15T05:56:44+00:00

I commited accidentally to much, I added the changes and wanted to do git

  • 0

I commited accidentally to much, I added the changes and wanted to do git commit -m "foo" but i mistyped me and typed git commit -a -m "foo".

How can I revert this, without loosing the changes which I made?

  • 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-06-15T05:56:45+00:00Added an answer on June 15, 2026 at 5:56 am

    Use git reset HEAD^. This will get rid of the most recent commit in your current branch but keep your working tree intact.

    Note that this rewrites history. In case you already published that commit it and people pulled it, it’s be better to revert the commit by creating a new commit using git revert HEAD that undoes the changes from the last commit.

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

Sidebar

Related Questions

I accidentally committed the wrong files to Git , but didn't push the commit
I commited a wrong file, so I wanted to clean it up, but accidentally
I have accidentally committed the .idea/ directory into git. This is causing conflicts everywhere
I added a new subdir within my git respository: git add feeds Then commited
I commited something wrong twice. How to revert two commits back and commit only
Kind of a strange question, but here is my scenario: I have accidentally added
I accidentally commited log/test.log but have never pushed it. I have since done a
Using git, I can throw away a mistaken or accidental commit using a command
When I started my git repo I commited a few files as initial commit
First time playing with git, and I accidentally added all hidden files with my

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.