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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:05:06+00:00 2026-05-28T05:05:06+00:00

I did a commit and reverted with git revert HEAD^ just git log ➜

  • 0

I did a commit and reverted with

git revert HEAD^

just git log

➜  git:(master) git log
commit 45a0b1371e4705c4f875141232d7a97351f0ed8b
Author: Daniel Palacio <danpal@gmail.com>
Date:   Tue Jan 17 16:32:15 2012 -0800

    Production explanation

But if I do git log –all it still show up. I need to remove it from the history as it has sensitive information

git log --all
commit 5d44355080500ee6518f157c084f519da47b9391
Author: Daniel Palacio
Date:   Tue Jan 17 16:40:48 2012 -0800

    This commit has to be reset

commit 45a0b1371e4705c4f875141232d7a97351f0ed8b
Author: Daniel Palacio 
Date:   Tue Jan 17 16:32:15 2012 -0800

    Production explanation

How do I remove the commit 5d44355080500ee6518f157c084f519da47b9391 from the history too?

  • 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-28T05:05:07+00:00Added an answer on May 28, 2026 at 5:05 am

    First off, git revert is the wrong command here. That creates a new commit that reverts an older one. That’s not what you’re asking for. Secondly, it looks like you want to revert HEAD instead of HEAD^.

    If you haven’t pushed this anywhere, you can use git reset --hard HEAD^ to throw away the latest commit (this also throws away any uncommitted changes, so be sure you don’t have any you want to save). Assuming you’re ok with the sensitive information being present in your copy and nobody else’s, you’re done. You can continue to work and a subsequent git push won’t push your bad commit.

    If that’s not a safe assumption (though if not I’d love to hear why), then you need to expire your reflogs and force a garbage collection that collects all outstanding objects right now. You can do that with

    git reflog expire --expire=now --expire-unreachable=now --all
    git gc --prune=now
    

    though this should only be done if you really absolutely need to do it.


    If you have pushed your commit, then you’re pretty much out of luck. You can do a force-push to revert it remotely (though only if the remote side allows that), but you can’t delete the commit itself from the remote side’s database, so anyone who has access to that repository can find it if they know what to look for.

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

Sidebar

Related Questions

To reset my last commit, I did this: git reset --soft HEAD^ But I
I just did my first ever git push : ~/sb/ws> git push ~/gitrepo master:master
I just did a git commit -m blah then I added some files, how
I did: git co upstream/master # To no branch. <then did a trivial edit
I'm using Git with GitGUI. I did a commit to several files (and have
I did a git commit -m message like this: > git commit -m save
I did a checkout to an earlier commit: git checkout 12345 Then back to
I did a git rebase -i on a commit several nodes earlier. I added
Seems like it would be better if you did commit followed by merge. I'm
I did a ton of changes to our code and before I commit, I

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.