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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:49:40+00:00 2026-06-04T22:49:40+00:00

Possible Duplicate: How can I remove a commit on github? How to delete a

  • 0

Possible Duplicate:
How can I remove a commit on github?
How to delete a 'git commit'

So I’m trying to remove a commit from github.

It is 3 commits ago and I’m ok if all the changes are lost.

So based on questions from here, I did a

git reset --hard <sha-commit-name-to-go-back-to>
git push -f origin HEAD^:master

Now it is gone from github as well as in git log.

I then redid my changes and did

git add <file I changed>
git commit
git log

Everything looks fine. There’s no trace of the old commits. So I finally did a:

git push

Now suddenly github has those three commits that I had removed.

What am I doing wrong? How to I keep the commits from returning?

  • 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-04T22:49:41+00:00Added an answer on June 4, 2026 at 10:49 pm

    Use git rebase process before applying new changes. After rebasing add the new changes and commit.

    git rebase -i HEAD~2
    
    git push origin +master
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to remove an XmlNode from XmlNodeList Hi, How can i delete
Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: How to delete a zip file using php How can I remove
Possible Duplicate: How to purge a huge file from commits history in Git? I
Possible Duplicate: How can I remove external links from HTML using Perl? Alright, i'm
Possible Duplicate: Removing multiple classes (jQuery) how can we remove multiple classes from one
Possible Duplicate: PHP: How to remove specific element from an array? How can i
Possible Duplicate: How to remove rvm (ruby version manager) from my system? How can
Possible Duplicate: Can you remove elements from a std::list while iterating through it? I
Possible Duplicate: SQL - How can I remove duplicate rows? SQL query to delete

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.