git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git filter-branch --subdirectory-filter not working as expected, history of other folders is preserved
@ 2016-10-10 13:42 Seaders Oloinsigh
  2016-10-10 15:30 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Seaders Oloinsigh @ 2016-10-10 13:42 UTC (permalink / raw)
  To: git

From

https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Now your new project root is what was in the trunk subdirectory each time.
> Git will also automatically remove commits that did not affect the
> subdirectory.
>

We have a git repository that looks like

sdk/
android/
ios/
unity/
windows/

Which we'd like to split into 4 repositories, 1 for each platform.  To
start this process (for splitting android out), I ran,

git filter-branch -f --prune-empty --subdirectory-filter android -- --all

Which rewrote a ton of history and commits, and looked like it worked, but
on closer inspection had left a ton of history behind.

If I run

git log --all -- unity/

It returns a list of commits that happened in the unity/ subfolder of the
original root.

commit c4ea2797...
> Author: tom... <tom@...ve.com>
> Date:   Thu Feb 25 14:20:59 2016 +0000
>
>     kick off build
>

> ...
>


Which only contains an edit to a file with path "unity/tom" relative to the
root *before* the filter-branch, doesn't exist any more, and from my
understanding of the docs, shouldn't have been taken across.

It's also not an isolated instance, if I run the same checks against
"ios/", "windows/", any file that existed in a folder other than "android"
to the old root, that history is also preserved.

I've just about resorted to running multiple other, explicit filters to
remove all references to those other folders, but it seems like this would
be redoing the job that I understood git filter-branch should have been
doing.

Any help in this regard is greatly appreciated.

seaders.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-11 13:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10 13:42 git filter-branch --subdirectory-filter not working as expected, history of other folders is preserved Seaders Oloinsigh
2016-10-10 15:30 ` Jeff King
2016-10-10 16:12   ` Seaders Oloinsigh
2016-10-10 18:19     ` Jeff King
2016-10-11 13:56       ` Seaders Oloinsigh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).