git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steinar Bang <sb@dod.no>
To: git@vger.kernel.org
Subject: Merging back from master but keeping a subtree
Date: Sat, 17 Sep 2011 09:49:40 +0200	[thread overview]
Message-ID: <87y5xn8v6z.fsf@dod.no> (raw)

I have a long lived branch that changes a directory and its
subdirectory, ie. 
 top/middle/mydirectory

Now I want to merge in an updated remoterepo/master and keep everything
from that master, except for mydirectory and its subdirectory, where I
would like to keep everything from my branch.

I tried a regular merge, and used
 git checkout --ours
 git add
and 
 git checkout --theirs
 git add
as appropriate on all conflicts.

But the result didn't build, and the build errors don't make much sense,
so I think they are caused by "successful" merges giving bad results.

Is there a better way to do this?

Would it be possible to unstage the already staged files and apply the
"checkout --ours" and "checkout --theirs", and then git add on the
checked out files?

Even that would be clumsy... I would have preferred something like
 git checkout --theirs top
 git checkout --ours top/middle/mydirectory
 git add-only-those-modified-wrt-my-branch


Thanks!

- Steinar

             reply	other threads:[~2011-09-17  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-17  7:49 Steinar Bang [this message]
2011-09-18  3:37 ` Merging back from master but keeping a subtree Jeff King
2011-11-16 13:39   ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5xn8v6z.fsf@dod.no \
    --to=sb@dod.no \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).