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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:52:19+00:00 2026-05-19T13:52:19+00:00

I have a bunch of branches, each with different features. Usually I’ll have some

  • 0

I have a bunch of branches, each with different features. Usually I’ll have some extra branch “not_master” which contains master+feature A like so:

(not_master)     a--b--c--d--e---M--x--y--z
(feature A)           --h--i--j-/

Sometimes I want to unmerge feature A, but keep commits x,y,z in “not_master”.

In other words, I would like this:

(not_master)     a--b--c--d--e--x--y--z

I see that I can do a git revert -m 1 M which will add a commit to the end that reverts my changes, but I don’t really want to do that since these commits haven’t been published yet so adding more commits makes the history even harder to read.

Others suggest just doing a git reset --hard M, but that will dump the changes of x,y,z. Am I just thinking about this the completely wrong way? Should I just git reset --hard M and cherry pick x,y,z?

  • 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-19T13:52:20+00:00Added an answer on May 19, 2026 at 1:52 pm

    git rebase will do what you want. git rebase -i <commit e> should work: it will open an editor, and you delete the merge commit and save.

    You should also be able to directly specify rebasing x..z onto e, but sorting out the semantics of the command-line is a bit hairy. If I’m reading the man page right, It should be git rebase --onto <commit e> <commit M> not_master.

    EDIT: Tested and appears to work:

    mkdir foo; cd foo
    git init
    touch initial
    git add initial
    git commit -m 'initial'
    git checkout -b topic
    touch topic
    git add topic
    git commit -m 'topic'
    git checkout master
    touch master
    git add master
    git commit -m 'master'
    git tag pre_merge
    git merge topic
    git tag merge
    touch post_topic
    git add post_topic
    git commit -m 'post topic'
    git rebase --onto pre_merge merge master
    

    results in a history of

    initial -- master -- post topic  (master)
          \
           \-- topic                 (topic)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bunch of strings, some of which are fairly long, like so: movie.titles
I have two branches: master and bug1. I checked out bug1, did bunch of
We have bunch of Domain Entities which should be rendered to an html format,
I have a bunch of strings that are dependent on static dictionaries and each
I have a project which was branched, and a bunch of files (F1) were
Currently, I have a large SVN repository with a bunch of different projects within
I have two branches that are different enough that rebasing seems to not work
I have bunch of longitudes and latitudes about some sport venues and gigs. I
I have bunch of hidden columns in my jqGrid, on which I want to
I have a bunch of source control folders for which I want to get

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.