threads / discuss / 38909

very weird behaviour with "merge -s subtree"

Subject: very weird behaviour with "merge -s subtree"

## tl;dr

3 messages between Mar 25, 2015 and Mar 27, 2015.

replies: 2people: 1as markdown or json

Kirill Marchuk· Mar 25, 2015, 12:55 UTC · lore
Hi everyone
  I'm totally stuck with a following problem:
- we have a repo, which contains several projects as folders - like 
"api", "adminUI", "android", "web" - etc. Some parts are backend, some 
frontend. Lets name these parts "details", as they constitute details of 
the project in general.
- we would like to deploy via git, so as to minimize effort on 
deployment (and automate it later).
- but every project is deployed separately.
 From all I've read so far, I came to conclusion that "merge -s subtree" 
seems to be done with this thing in mind, although scenarios,
described in articles like this one 
(https://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html) 
usually take only one part of it: merge from "detail" to "common", and 
not vice versa.

So, what am I trying to: to implement a stable workflow, that would allow me to easily merge changes from "develop" in "common" repo to a "subtree-branch" and push to a corresponding "detail" remote.

What I am doing:
1) say, we have a folder "adminUI" in the root of "common" repo, branch 
"test" (it's a snapshot branch for test environment - all deploys should 
start here)
2) git remote add adminui-origin <path>
3) git fetch adminui-origin
4)  git checkout -B test-adminui adminui-origin/test
(above steps are taken from 
http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging)
5) git checkout test
6) git merge -s ours --no-commit test-adminui
(this one is from 
https://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html)
7) git read-tree --prefix=adminUI/ -u test-adminui
Here I always get error like:
error: Entry 'adminUI/.gitignore' overlaps with 'adminUI/.gitignore'.  
Cannot bind.
8) so, I have to rename folder "adminUI" to, like, "adminUI2", then "git 
commit -a", then step 7 again
9) ok, so now I have a whole content of "adminui-origin" in folder 
"/adminUI" in branch "test" of my "common" repo.
10) then I merge changes from "develop", which I want to deploy: git 
merge develop
11) then I want to merge those changes "down the line" into "detail" repo:
git checkout test-adminui
git merge -s subtree test
12) for the first time, everything seems fine - only relevant changes 
(i.e., changes in adminUI folder) are merged, and they go straight into 
their right places (i.e., with respect to folder structure difference 
between "common" and "detail")
13) git push adminui-origin test-adminui:test  - this works good
14) let's say something else was updated in develop:
git checkout test
git merge develop
git checkout test-adminui
15) AND HERE BEGINS THE HELL:
git merge -s subtree test => leads to ALL of my working directory being 
copied to a 3rd level folder somewhere in the adminUI depths !!!
This drives me TOTALLY insane, and I very much need help !!
I use msysgit 1.9.4 on Windows 8.1

I suspect that it might have to do with the repository structure, maybe some errors, etc..

But I believe that it might be due to my total misunderstanding of something
Anyway, I totally appreciate your help !
Thanks a lot
Kirill, frustrated unexperienced git user...
Kirill Marchuk· Mar 26, 2015, 11:08 UTC · re: Kirill Marchuk · lore

Re: very weird behaviour with

Kirill Marchuk <62mkv <at> mail.ru> writes:
> 
> Hi everyone
> 
>   I'm totally stuck with a following problem:

(censor cut) ...........

Show 10 quoted lines
> 
> But I believe that it might be due to my total misunderstanding of something
> 
> Anyway, I totally appreciate your help !
> 
> Thanks a lot
> 
> Kirill, frustrated unexperienced git user...
> 
> 
Hi Again
With "git subtree" today I have had even worse experience: 
1) git checkout test
2) git branch test-tmp
3) mv adminUI adminUI2 (because otherwise errors..)
4) git commit -a -m "Renamed adminUI" 
5) git subtree add --prefix=adminUI adminui-origin/test --squash
6) mv adminUI adminUI2 (because I don't want here the "deploy" versions)
7) git commit -a -m "Added adminui as subtree"
8) git merge develop (!!!!!! it went smoothly, but... see below)
9) git checkout adminui-test
10) git subtree merge --prefix=adminUI test-tmp
11) git push adminui-origin test-adminui:test
(instead of 9-11 I've tried to use "git subtree push", it's basically the
same, I believe, only takes FAR more time to complete)

I was very glad and happy. Unless I've realized that, in fact, step 7 did not proceed as it was intended to (by me, at least)

It has 2 parents, and 2 diffs, and one of them shows exactly what it has to show (i.e. diff between tips of "develop" and "test-tmp"), but the files on the commit snapshot were left unchanged (I cannot imagine how could that happen, but that did)

If I modify files and commit them RIGHT INTO test-tmp branch, all the rest goes fine (so far), but that unability to merge from "develop" is something that's killing the whole point of it :((

I believe I am not the only one on this mailing list, so pleeease... 
Kirill
Kirill Marchuk· Mar 27, 2015, 10:58 UTC · re: Kirill Marchuk · lore

Re: very weird behaviour with

Kirill Marchuk <62mkv <at> mail.ru> writes:
Show 55 quoted lines
> 
> Kirill Marchuk <62mkv <at> mail.ru> writes:
> 
> > 
> > Hi everyone
> > 
> >   I'm totally stuck with a following problem:
> (censor cut)
> ...........
> > 
> > But I believe that it might be due to my total misunderstanding of something
> > 
> > Anyway, I totally appreciate your help !
> > 
> > Thanks a lot
> > 
> > Kirill, frustrated unexperienced git user...
> > 
> > 
> 
> Hi Again
> 
> With "git subtree" today I have had even worse experience: 
> 
> 1) git checkout test
> 2) git branch test-tmp
> 3) mv adminUI adminUI2 (because otherwise errors..)
> 4) git commit -a -m "Renamed adminUI" 
> 5) git subtree add --prefix=adminUI adminui-origin/test --squash
> 6) mv adminUI adminUI2 (because I don't want here the "deploy" versions)
> 7) git commit -a -m "Added adminui as subtree"
> 8) git merge develop (!!!!!! it went smoothly, but... see below)
> 9) git checkout adminui-test
> 10) git subtree merge --prefix=adminUI test-tmp
> 11) git push adminui-origin test-adminui:test
> (instead of 9-11 I've tried to use "git subtree push", it's basically the
> same, I believe, only takes FAR more time to complete)
> 
> I was very glad and happy. Unless I've realized that, in fact, step 7 did
> not proceed as it was intended to (by me, at least)
> 
> It has 2 parents, and 2 diffs, and one of them shows exactly what it has to
> show (i.e. diff between tips of "develop" and "test-tmp"), but the files on
> the commit snapshot were left unchanged (I cannot imagine how could that
> happen, but that did)
> 
> If I modify files and commit them RIGHT INTO test-tmp branch, all the rest
> goes fine (so far), but that unability to merge from "develop" is something
> that's killing the whole point of it :(( 
> 
> I believe I am not the only one on this mailing list, so pleeease... 
> 
> Kirill
> 
> 

Even more mysterious thing happens today... when I do git checkout test-adminui git subtree merge --prefix=adminUI test-tmp

I receive 'adminUI' does not exist; use 'git subtree add'

all the difference I can possibly think of, is that it probably requires me to create "subtree" after every push ?? or is it due to my checkout-s and pulls into other branches during the day ?

No ideas

Any help is greatly appreciated.. Although I am starting to think that I probably chose wrong channel to seek for help on this case...

Thanks for any reaction.
Kirill

← back to recent threads