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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:30:16+00:00 2026-06-15T18:30:16+00:00

I have (or am aiming to have!) a repo like so: Master *—–*–*———-C— \

  • 0

I have (or am aiming to have!) a repo like so:

Master *-----*--*----------C---
        \                   \
Project1 \-*-------A----B----M2---A'--B'---
          \              \             \
Project2   \----------*---M1------------M2---

I would like to do the merge M2 but I would like A and B to be completely ignored. I will then manually (e.g. cherry-pick) recreate A’ and B’ as/if necessary atop the new changes from the master.

Project2 is based on the Master, but merges in changes from Project1.

Desired outcome:

  1. I want point M2 to be an identical copy of C in terms of files.

  2. I need Project1 to have its own linear history so that Project2 can merge from it.

Context: Master is Drupal’s main codebase. Project1 is a branch I use to maintain specific patches that I wish to share with several projects. Project2 (and many others) merge from Project1.

I have considered:

  1. git merge -s recursive -X theirs master problem with this is that AFAIK it will only prefer theirs if something conflicts. So if a change in A does not conflict, it will be present at M2 which will mean that A’ will be incomplete.

  2. git revert B..A ; git merge C This will work but will leave me with a messy and long history.

  3. There is git merge -s ours but there does not seem to be a git merge -s theirs.

  4. I do not want to git reset --hard C because this will (I think) break the possibility of merging Project1 into Project2. Another approach would be to rebase Project1 onto C, but again, this would mean I could not merge into Project2.

  • 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-15T18:30:17+00:00Added an answer on June 15, 2026 at 6:30 pm

    This can be done with the “plumbing” commands:

    $ git checkout Project1
    $ git diff HEAD..master | patch -p1 
    $ git add -A .
    $ git commit-tree `git write-tree` -p master -p Project1 \
          -m "Merge to clean Master at v1.2"
    0c5290081989cc28ff3977fbfe3951db7b7778b0
    $ git reset --hard 0c5290081989cc28ff3977fbfe3951db7b7778b0
    

    The git diff HEAD..master will tell me how to get from where I’m at (B) and where I want to be (C) in one big patch, and patch will, of course, apply it.

    git add -A . will add all the changes in the working tree into the index.

    We then create a merge commit for this with the next line: the git-write-tree creates a new tree object from the index, and outputs its SHA1 as an argument to git commit-tree, which creates a commit for it having two parents, the current heads of Project1 (B) and master (C), and give it a suitable message.

    Git will create the commit object, but it won’t update any branches to use this commit. The final line tells git that we want our current branch, Project2, to be advanced (fast forwarded) to the commit SHA1 it generated.

    From there you can recreate (e.g. might try with cherry-pick) the patches A’ and B’, if necessary.

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

Sidebar

Related Questions

I have created a module in access 2007 that will update linked tables, but
I have had numerous bad experiences with GUI library so I would like to
Here's an example of what I'm aiming for: I don't like I have to
I have a Window where I have put a Frame. I would like to
I have the following code: print $node->field_carousel_1[0]['filepath']; What i would like to do is
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I am aiming for clean URL's in my WP site, currently I have the
I am trying to get a pie chart display correctly but have found there
I have an activity, composed of an AsyncTask aiming to launch a request when
I have this code: $('#custom-options label').click(function(){ $(this).removeClass('uncheck').addClass('checked'); }); What I'm aiming to do this

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.