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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:43:36+00:00 2026-06-02T20:43:36+00:00

I have a repo where I made a change that is causing merge hell

  • 0

I have a repo where I made a change that is causing merge hell and I’d like to pretend it never existed. Long, complicated story involving splicing a pre-existing repo on top of one that is updated via git-p4, but the upshot is I really, really want git to pretend a certain change never existed.

If it were Mercurial, I’m pretty sure I could fix my problem with hg strip, but I can’t find such a command in Git.

Thanks for any suggestions you might have.

  • 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-02T20:43:38+00:00Added an answer on June 2, 2026 at 8:43 pm

    There is more than one command that you need to do. The first, as other people have mentioned, is git reset. You’ll want to find the changeset just before the one you want to get rid of, and use

    git reset --hard <changeset>
    

    This will change the current branch head (and the index) to point at that changeset, but the “bad” changeset is still present. It won’t get included if you push, but it will be included if you clone your local repository and it can still be referenced in log and checkout commands.

    Assuming there are no other references to it (e.g. subsequent commits, tags, etc…) you can then clean it up with:

    git gc --prune=now
    

    I found this command thanks to http://help.github.com/remove-sensitive-data/, which also mentions that (as with hg strip) if you’ve pushed that “bad” changeset to a remote location you can’t remove it with regular git commands but you’ll need to take additional steps to remove and recreate the repository on the server and clean up any cached pages.

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

Sidebar

Related Questions

Hi I have SVN repo that I frequently use for change management. However after
I have a repo that's forked from a remote repository. I made some changes,
In my git repo which is tracking a svn repo I have made a
I have a repo (origin) on a USB key that I cloned on my
Suppose that: I have a repo called MyRepo. I have uncommitted changes in my
I have a git repo with a bunch of source code, and when that
I'd like to have git automatically push local changes to the upstream subversion repo
I have a repo with 3 branches: master, Stable, and dev. I made a
I have downloaded Android source code with repo, then I made some changes in
On my local machine I have cloned a remote repo, made some changes, commited,

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.