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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:38:24+00:00 2026-05-25T23:38:24+00:00

git version 1.7.5.4 I have about 5 branches. All from the same initial branch.

  • 0

git version 1.7.5.4

I have about 5 branches. All from the same initial branch.

I want to merge 2 branches together. say, branch1 and branch2. These branches have a lot of differences.

I am currently working on branch1 and have just realized there are some changes I implemented in branch2 that I want in branch1.

what is the best way to merge?

checkout branch2 and merge branch1

or

checkout branch1 and merge branch2

Or doesn’t it matter which branch you need to checkout to merge with another branch?

  • 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-25T23:38:25+00:00Added an answer on May 25, 2026 at 11:38 pm

    Usually it does not matter if both branches are topic or feature branches.

    However, if you have an integration branch or a branch that marks what’s been published, you definitely want to use the long lived integration branch as the one that’s checked out and merge the other one into it.

    The reason for this is that the merge commit will mark the first parent commit as the one coming from the main branch. Your tree-ish specification for the history for that branch is easy now. To find the commit that was the 4th last in this branch, you simply

    git show head~4
    

    If you merged from the other branch somewhere in between, you would have to explicitly switch to the second commit wherever the merge was done the other way:

    git show head^^2^^
    

    This can cause problems with major branches for another reason; merging them into topic or feature branches is referred to as “back merging” and is not a good idea. I recall Linus Torvalds blowing his top when contributors did that. It would not allow him to cleanly separate what features he wanted to merge for a major revision as the feature branches would bring in an old test merge that included things he does not want anymore.

    So in the end, if one branch is more significant and is more than just a feature, check it out and merge from there. You’ll be able to keep it’s history viewed easily as you know that it’s first parent is always where that branch was before. If you don’t, you’ll have to rely on reading the merge commit messages and it’s just not as fun. 🙂

    I’ve written an article about BpF which shows a rigorous method of keeping branches organized: http://dymitruk.com/blog/2012/02/05/branch-per-feature/

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

Sidebar

Related Questions

Possible Duplicate: Show the original branch for a commit git version 1.7.4.1 I have
I have recently moved from SVN to Git and am a bit confused about
I'm using Git for version control and unlike SVN I have not come across
I have been using Git for my version control for a while now, but
I have been hearing a lot about the advantages of using a version control
I am new to git and distributed version control but have managed, without much
Context We use several git repositories with the same workflow, involving two branches, and
I hear all this stuff about bazaar being slower than git. I haven't used
I am quite new to git and version control in general, and have question
I'm using git version 1.5.6.3, and it seems git doesn't notice a folder's mode

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.