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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:37:37+00:00 2026-06-05T20:37:37+00:00

In git, i have 2 commit and a branch merge that have been rebased

  • 0

In git, i have 2 commit and a branch merge that have been rebased to look like this

7
6_
  5
  4
3_|
2
1

the merge was done with no-ff.

my client doens’t want to roll out commits 1 and 2, so im trying to rebase it to look like this

1
2
7
6_
  5
  4
3_|

This is desirable because then i can branch off of commit 7 and that is my production release.

rebase -i XXXX

flattens the whole thing and has a huge number of conflicts. since im trying to prepare a production rollout, i don’t want to have conflicts because the code will have to go back to testing.

when i do this

rebase -i -p XXXXXX

it moves the commits 1 and 2 correctly, but it deletes the merge and the 4 weeks of work associated with it. how in the world do i do this?

  • 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-05T20:37:39+00:00Added an answer on June 5, 2026 at 8:37 pm

    Create a patch from the two commits and apply them in reverse mode to head.

    Pro:

    1. Simple solution
    2. pretty safe depending on the size of the changes

    Con:

    1. Leaves the commits in the commit history
    2. Depending on the amount of changes to the code that is in the two commits, (i.e. changes to the code that happens in the rev. 3-7), the reverse apply won’t work

    Another hack would be to checkout without the last 7 revisions. Then create patches for the revisions 3-7 and apply those. Should give you the same result and a clean commit history.

    But in both cases, I’m wary because you got a lot of conflicts during the rebase.

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

Sidebar

Related Questions

Suppose I have Git repository like this: git-repo/ directory_1/ directory_2/ directory_3/ This has a
I have a local branch that is tracking of a remote branch on git.
I have a fork to a github repo that I want to merge with
Let's say that I want to merge from a release branch to the master
What are the current best practices with git branches that have been created to
I have a ton of new files to commit. Clicking each one in git
When I do a 'git pull', I have conflict with the head commit. So
My git repository has ~2,000 commits. For educational purposes, I have been playing around
I'm fairly new to Git, and have been working with it for only 3
I have been studding GIT for the last couple of weeks in an attempt

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.