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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:57:50+00:00 2026-06-15T06:57:50+00:00

So I have a branch of master, let’s call it foo, that I’ve been

  • 0

So I have a branch of master, let’s call it foo, that I’ve been using for a while, and after about 50 commits or so I was getting a rather complicated merge history, as foo had some subbranches of its own. The history was not important to me here, so I decided to clean things up by rebasing each branch and squashing all the commits down to one, so that I’d have just one commit representing the difference between master and that branch.

At first I thought I could just do:

git checkout foo
git rebase master

but this didn’t work out for me. The branch had over 50 commits, each touching many files, and each commit was getting a bunch of conflicts.

Instead, what I ended up doing was this:

git checkout foo
<copy all files to another folder>
git checkout master
git branch -D foo
git checkout -b foo
<overwrite all files with the copy I made earlier, and create a new commit>

This served my needs of turning the long history of merges into a single squashed rebase without dealing with all the conflicts along the way, but I’m just wondering if there was a more “git-friendly” way of doing 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-15T06:57:52+00:00Added an answer on June 15, 2026 at 6:57 am

    The friendlier way of doing this in git is to make a 3rd integration branch. As you develop foo, merge master and foo on that. This will show git how you are dealing with the code bases changing at the same time. It is important to have rerere (reuse recorded resolution) enabled in your config.

    Now when you are finally ready to merge foo into master, git will know how to resolve the conflicts as you were telling it how to do that all along.

    Or, just merge that integration branch into master when ready. You should have no conflicts. It depends if you can tolerate all those test merges in your history.

    This is somewhat related to my post on Branch per Feature:
    http://dymitruk.com/blog/2012/02/05/branch-per-feature/

    I don’t recommend squashing commits as you lose information on how files came to be in the state that they are in. The more information that git has to work with, the better.

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

Sidebar

Related Questions

Let say I create a branch called foo from master and while working on
Let's say that I have a file core.clj in branch master at HEAD which
I have made commits to my local branch (let's just say master) and have
I have a 'master' branch and several topic branches. Assume that the master branch
I have a simple Git repo with non-branching commits in the master branch. I
Let's say I have a private topic branch called develop with 2 commits ahead
In master I have some files that should better live in a feature branch.
let's say I have the following config file [branch master] remote = origin merge
Let's say that in our Git repository, we worked on branch master for a
Let's say I have a project that I have worked on for a while,

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.