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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:44:35+00:00 2026-05-24T07:44:35+00:00

I’m not sure if this is a normal branching scenario but … suppose that

  • 0

I’m not sure if this is a normal branching scenario but …

suppose that I create a branch, say branch C, from master and then merge back other previously existing branches, say branches A and B, back into master, and I need some of the code from A and B in branch C then can I merge from master to branch C?

And if so, are there any reasons why this would not be a good idea? Is this a common operation in git?

  • 1 1 Answer
  • 3 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-24T07:44:36+00:00Added an answer on May 24, 2026 at 7:44 am

    Yes and yes.

    You can merge whichever way you like in git. Merge simply means “combine these histories”. When git can’t, its default mode is to just dump the changes on you, a “merge conflict” but you can also alter that behaviour to lean towards “ours” or “theirs”. Take a look at the git-merge docs for a full explanation of the hundreds of options…

    So, from your explanation, a diagram of histories might look like this:

    *-------*-------*------* master
            |
            *----*-----* A
            |
            *-------* B
            |
            *----* C
    

    Where * is just some commit on that branch, except the point they’re all created. So how do you fix this issue? Well, I would:

    git checkout A
    

    being on A, basically we’re going to merge A in to master like so:

    git merge master
    

    there is a good reason for doing that – when presented to another developer, assuming the merge is accurate, this represents a straightforward fast-forward merge for them. In other words, to merge A into the actual master in someone else’s repository this becomes easier. Now, the next step, which you or another developer could do:

    git checkout master && git merge A
    

    That pulls in A. It should basically have no merge conflicts at all, since the process of merging master into A resolved them and the developer responsible for integrating A handled it.

    So then

    git checkout B && git merge master
    

    again, resolve merge problems, then git checkout master && git merge B

    Finally, you’re saying can I merge master into C? Absolutely. We’ve just done that process twice.

    We use this particular way of doing things at work. Basically, I get the other developers to let me know when their branches are ready, then I merge them in, then everyone merges master into their branches, and the process repeats. You can even do this with remote repositories. If you have tracking branches in a remote, git pull pulls in your changes. This is actually a git fetch followed by a git merge, So if you’re not tracking somebody else’s branch, you can still apply the merge like so:

    They can do git merge leaddeveloper/master where leaddeveloper is a remote name. Then they can correct any conflicts, send an email to the lead developer saying “please pull” and the lead developer can type git fetch && git merge juniordeveloper1/somebranch or more likely git fetch && git diff master..juniordeveloper1/somebranch to work out what they’ve done first.

    In short, this I think is a really good way of managing a project. It keeps everyone up to date and ensures the guy handling the main master doesn’t also have the job of integrating the code.

    On the subject of git rebase, this question deals with it very neatly.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I want to count how many characters a certain string has in PHP, but

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.