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

  • Home
  • SEARCH
  • 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 8728421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:38:12+00:00 2026-06-13T08:38:12+00:00

I had two branches both independent. I worked on them at various points over

  • 0

I had two branches both independent. I worked on them at various points over a month. I went to merge one branch (let’s call it apple) into the other (let’s call it orange) by checking out orange and doing git merge --no-ff apple and everything went fine. In gitk I could clearly see the branches each had their own history and it was merged together in a merge commit on orange.

Later I realize that a commit in orange is incorrect, there is a mistake in the build process, and I must edit that early commit on orange. I use git rebase -i HEAD~19, choose the commit and change pick to edit. So I edit the commit and everything is fine, and I finish the rebase. I go back into gitk and all the history of the two branches is one linear history on orange.

So did I screw something up or is this the way it’s supposed to be? I used git reflog to go back to when I did the merge, then I did another reset hard to go back to right before the merge on orange, then I did the rebase and fixed that commit, then after that I did the merge. Now everything looks the way I’d expect where the commits from the branches aren’t interlaced together.

For future reference can someone tell me how I can rebase commits on a branch where I’ve merged in another branch, without ending up with interlaced commits (linear history)?

If my terminology isn’t correct feel free to edit this. Thanks again

  • 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-13T08:38:13+00:00Added an answer on June 13, 2026 at 8:38 am

    This is expected behavior of rebase.
    It effectively re-writes the history of the branch, and that causes it to (default) lose merges and other meta-data, leaving a straight, simplified branch.

    You can preserve merges by using

    git rebase --preserve-merges
    

    but there are some issues with combining --preserve-merges with --interactive. Tread carefully.

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

Sidebar

Related Questions

I work with two branches of the same project. Both of them were created
I've initially had two branches: master A---B---C \ fork D---E---F---H---I So I wanted to
I had two separate interfaces, one 'MultiLingual' for choosing language of text to return,
I had two branches ( master and gh-pages ) in github git repo https://github.com/larrycai/LASO
In a file that I am using, I merged two branches one after the
We have two different projects on our source safe database (one of them is
I have two branches, the main branch(black) and a feature branch(yellow). As you can
I had two queries - one that selects group_id by knowing the post_id ,
I had a problem with committing changes after merging two branches of my project
I'm trying to perform a baseless merge between two branches using tf.exe. When I

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.