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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:36:47+00:00 2026-05-22T01:36:47+00:00

I did something stupid and accidently merged a topic branch into my master branch

  • 0

I did something stupid and accidently merged a topic branch into my master branch and then pushed it live to github (where others have pulled). Just to make sure it was a completely moronic mistake, I pulled it out to my production servers.

I’ve hung my head in shame for the appropriate amount of time and now I need to figure out how to effectively roll back the code commits while progressing the commit history.

To get my production code to the correct checkout, I ran git checkout hashoflettersandnumbers and that’s the commit I want the production HEAD to be.

I run git reset hashoflettersandnumbers and then git clean to remove the changes from that commit going forward, but I can’t seem to get that code to be the HEAD of the master branch and make a fresh commit.

  • 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-22T01:36:48+00:00Added an answer on May 22, 2026 at 1:36 am

    Use git revert on each of the branches. This will create a new commit that preserves your mistake for all eternity, but gives you back the same tree as you had before you merged.

    For example, if 123456 is the merge commit…

    $ git checkout master
    $ git revert 123456
    $ git checkout topic-branch
    $ git revert 123456
    

    This assumes that this wasn’t a “fast-forward” merge.

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

Sidebar

Related Questions

I did something like this to initially hide the body scrollbar, and then show
I did just something really fucXXing stupid. I wrote over my actionscript code, saved
I'm seriously betting that I did something effing stupid and just can't seem to
I did something silly in an R session. I wrote print = FALSE Now
I did something similar to: http://tympanus.net/codrops/2012/01/04/thumbnail-proximity-effect/ and just like the original it works in
I just did something dumb with my SVN repository, I accidentally imported a load
Somewhere I did something silly. I was deploying my Rails app via cloning the
Last night I think I did something that hosed my rails development environment, and
I need to do form validation, I even did something like this on one
So I read the tutorial from some web, and they did something like this.

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.