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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:17:09+00:00 2026-06-17T19:17:09+00:00

Currently the best solution that I found is git reset –soft HEAD^2 to keep

  • 0

Currently the best solution that I found is

git reset --soft HEAD^2 

to keep wanted changes

git reset --mixed HEAD^

to kill unwanted commit

unfortunately it will force me to recreate commits made after one that I want to disappear

  • 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-17T19:17:10+00:00Added an answer on June 17, 2026 at 7:17 pm

    try git rebase -i <target commit>^

    Then when presented with the list of commits to rebase, delete the line for the commit you want to remove.

    For example, if I have:

    6e99176 most recent commit
    60dd2f0 older commit
    4c82808 even older commit
    b980abe commit i want to remove
    5b7254b oldest commit
    

    I can do

    git rebase -i b980abe^
    

    And will be presented with:

    pick 6e99176 most recent commit
    pick 60dd2f0 older commit
    pick 4c82808 even older commit
    pick b980abe commit i want to remove
    
    # Rebase 50ce3f5..9ad75f8 onto 50ce3f5
    #
    # Commands:
    #  p, pick = use commit
    #  r, reword = use commit, but edit the commit message
    #  e, edit = use commit, but stop for amending
    #  s, squash = use commit, but meld into previous commit
    #  f, fixup = like "squash", but discard this commit's log message
    #  x, exec = run command (the rest of the line) using shell
    #
    # If you remove a line here THAT COMMIT WILL BE LOST.
    # However, if you remove everything, the rebase will be aborted.
    #
    

    If you follow the instructions and remove the offending commit, then save and close the file, you will have removed that commit from your git history.

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

Sidebar

Related Questions

What are the current best practices with git branches that have been created to
What is the currently best method to detect spam ? especially on mobile text
Am currently evaluating the best RIA technologies to use for building a new e-commerce
I am currently considering the best way of building a relatively complex page in
What is the best way to retrieve records from the database? Currently we are
What is the best way to retrieve the current date? Currently I am storing
I'm unsure on the best stack to build a chat application. Currently I'm thinking
I'm currently working on a website in PHP, and I'm wondering what the best
what are the best books to learn about junit, jmock and testing generally? Currently
I'm pretty new to the Symfony Framework and currently searching for the Best-Practice way

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.