threads / discuss / 35570

git subtree split - nested subtree history not preserved on parent split

Subject: git subtree split - nested subtree history not preserved on parent split

## tl;dr

One message between Dec 24, 2013 and Dec 24, 2013.

replies: 0people: 1as markdown or json

Alexander Boyd· Dec 24, 2013, 10:15 UTC · lore
Hello,

I've been playing around with nested subtrees, and I've discovered what I'm pretty sure is a bug: when I import a repo into a nested directory with `git subtree add`, then split the imported directory's parent, the subtree's history is lost.

To clarify:

# Create a repo with a single file git init nested cd nested echo contents > test git add test git commit -m "Add foo" cd ..

# Create an outer repo git init outer cd outer echo contents > bar git add bar git commit -m "Add bar"

# Import nested into outer/dir/nested git subtree add --prefix dir/nested ../nested master

# Split outer/dir git subtree split --prefix dir --branch history-of-dir

Now `git log master` includes "Add foo" in its history but `git log history-of-dir` doesn't, even though 'nested' is a child of 'dir'.

I have a (very) rough guess as to what's going on: `git subtree split` sees the side of the merge importing nested's changes as only touching files "outside of" the directory it's splitting out, so it happily omits them from the split history.

Has anyone else run into this?
-Alex

← back to recent threads