Re: how to use git merge -s subtree?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 6 Jan 2008 00:00:04 +0100
Miklos Vajna <vmiklos@xxxxxxxxxxxxxx> wrote:

> i recently noticed that the subtree merge strategy is missing from
> merge-strategies.txt an i tried to first figure out how it works. i got
> it to work, but i'm not 100% sure about i'm using it the way i'm
> supposed to.
> 
> here is what i do:
> 
> 1) git remote add B /path/to/B.git
> 2) git fetch
> 3) mkdir B
> 4) touch B/.gitignore
> 5) git add B/.gitignore
> 6) git commit -m "add empty B directory"
> 7) git merge -s subtree B/master
> 
> and yes, it works pretty well, but is this the right way? or is it
> possible to somehow avoid steps 3..6?
> 

Hi Miklos,

Here's another way that is perhaps a little cleaner:

$ git remote add -f B /path/to/B
$ git merge -s ours --no-commit B/master
$ git read-tree --prefix=sub/ -u B/master 
$ git commit -m "subtree merged B"

The first line creates and fetches the remote.  The second line initiates a merge, but
stops before committing it.  The third line reads B/master into the subdirectory "sub",
at which point all that remains is committing the completed merge.

HTH,
Sean
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux