Skip to contentSkip to conversation

git subtree issues

DISCUSSION morgflast 2 participants 3 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore

morgflast

author
#0 lore raw

So, I went ahead and did this

$ git remote add -f vw_extensions [email protected]:sibblingz/vw_extensions.git
(1)
$ git merge -s ours --no-commit vw_extensions/master (2)
$ git read-tree --prefix=some/directory/vw_extensions -u
vw_extensions/master (3)
$ git commit -m "Merge B project as our subdirectory" 

And that all seems to work ok.

Then, I went to another directory where i had vw_extensions cloned, and made a change to the README file, and pushed it.

I went back to my first project, and did this, to try to pull those changes:

git pull -s subtree vw_extensions master remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From [email protected]:sibblingz/vw_extensions
* branch master -> FETCH_HEAD
Already uptodate!
Merge made by subtree.

However, when I looked at the README file in the first project, the changes weren't there. I was wondering if anyone might have any suggestions about what to do.

Thanks!
Daniel

Signature · 2 lines
View this message in context: http://old.nabble.com/git-subtree-issues-tp26159961p26159961.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw
Quoted 9 lines · morgflast

git pull -s subtree vw_extensions master remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From [email protected]:sibblingz/vw_extensions
 * branch            master     -> FETCH_HEAD
Already uptodate!
Merge made by subtree.

Quoted 3 lines

However, when I looked at the README file in the first project, the changes weren't there.  I was wondering if anyone might have any suggestions about what to do.

Hmm, the output certainly wasn't very helpful :(

Usually what "already uptodate" means is that the commit it merged didn't actually cause any changes. Is it possible there's another README file that already contained this change?

The other problem with subtree merge is that it tries to *guess* which subtree you want to merge, which unfortunately fails almost as often as it succeeds. If it guessed incorrectly, it might have thrown away all the directories except one that didn't change at all. If this is the problem, I don't have an easy fix; my git-subtree command (which makes it a bit easier to do the things you're trying to do in your email) suffers from this too. Eventually I was thinking of giving in and making subtree merge properly configurable, but I haven't had time.

Or maybe this is a totally different problem. What do you get from:

  git diff --stat $(git merge-base HEAD^ FETCH_HEAD) FETCH_HEAD

?

Avery

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 11 lines · Daniel Jacobs

Ok.. I ran the command as you suggested
git pull -s subtree vw_extensions master
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From [email protected]:sibblingz/vw_extensions
 * branch            master     -> FETCH_HEAD
Already uptodate!
Merge made by subtree.

Quoted 5 lines

git diff --stat $(git merge-base HEAD^ FETCH_HEAD) FETCH_HEAD README |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)

So, it knows there was a change.  However, when I go and vim that README file, the change is not there.  Maybe this gives you some more information.

This is extremely fishy. What if you re-run the pull without the "-s subtree" at all? git must be trying to merge those changes in *somewhere*...

Quoted 4 lines

As an aside, I saw your git subtree tool, and it looks great, but I did not try to use it because I could not figure out how to install it.  You might get a few more users if you include instructions for installation somewhere. :-)

Oops, good point. Somehow I forgot that. Fixed.

Thanks,

Avery