threads / discuss / 21459

git subtree issues

Subject: git subtree issues

## tl;dr

3 messages between Nov 3, 2009 and Nov 4, 2009.

replies: 2people: 2as markdown or json

morgflast· Nov 3, 2009, 03:56 UTC · lore
So, I went ahead and did this

$ git remote add -f vw_extensions git@github.com: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 git@github.com: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

-- 
View this message in context: http://old.nabble.com/git-subtree-issues-tp26159961p26159961.html
Sent from the git mailing list archive at Nabble.com.
Avery Pennarun· Nov 3, 2009, 15:43 UTC · re: morgflast · lore

Re: git subtree issues

On Mon, Nov 2, 2009 at 11:56 PM, morgflast <daniel@sibblingz.com> wrote:
Show 12 quoted lines
> 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 git@github.com: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.
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
Avery Pennarun· Nov 4, 2009, 19:57 UTC · lore

Re: git subtree issues

On Tue, Nov 3, 2009 at 1:19 PM, Daniel Jacobs <daniel@sibblingz.com> wrote:
Show 16 quoted lines
> 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 git@github.com:sibblingz/vw_extensions
>  * branch            master     -> FETCH_HEAD
> Already uptodate!
> Merge made by subtree.
>
> 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*...

> 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

← back to recent threads