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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:48:34+00:00 2026-06-07T14:48:34+00:00

This is similar to my another question ( Switch to another branch without changing

  • 0

This is similar to my another question ( Switch to another branch without changing the workspace files ) but solution that worked there, doesn’t work now.

I needed to remove some changes, which were long time ago pushed to remote master. So I don’t want to remove commits from master, but I want to change the files just like these changes were reverted. So I did this:

  1. While on master, git branch limits
  2. git checkout limits
  3. git rebase --interactive <commit before the ones I wanted to remove>
  4. in interactive console I removed the commits with changes I wanted to revert

So now in limits I have the code like I’d like it in master. How can I “move” it to master? With the code from limits I’d like to change to master branch, but without changing any file in workspace, so I can then commit the changes as a new change to master.

  • 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-07T14:48:38+00:00Added an answer on June 7, 2026 at 2:48 pm

    Rather than use interactive rebase, you can just revert each commit that you don’t want. When you use git revert <object-name-of-commit>, git will introduce a new commit that backs-out the change introduced by the one you name. So, suppose that the commits you want to remove are abc123 and def456, you can just do:

    git checkout master
    git revert abc123
    git revert def456
    

    However, if it was a lot of work to find those commits, and you’re happy with the tip of limits, you can just create a new commit on master that contains the state of the tree from there. Firstly, make sure that git status is clean, since you’re going to use git reset --hard, and that will wipe out uncommited changes:

    git checkout master
    git reset --hard limits
    git reset --soft HEAD@{1}
    git commit -m "Reverting unwanted commits"
    

    That recipe is a variation of one in this question:

    • https://stackoverflow.com/a/1895095/223092
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there is another question that exists similar to this one but I
This is similar to another question (http://stackoverflow.com/questions/935556/mysql-dump-by-query) but I hope different enough. I want
This is similar to another question I've asked, but, I've created an expression class
This is similar to another question I posted, but I was told to split
This is very similar to another recent question: How can I return the current
I have checked this similar question, but the suggestions did not solve my problem:
I found this similar question here , but this is really old. Was it
This is similar to (but different from) this question . Here is some simple
This is very similar to another question ( Functional Data Structures in Java )
I posted another question similar. This is my old code as some ppl say

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.