Thread (25 messages) flat view 25 messages, 5 authors, 2016-06-15

git filter-branch --subdirectory-filter, still a mistery

From: Jan Wielemaker <hidden>
Date: 2016-06-15 22:45:07

Hi,

I've been puzzling most of today to do something that must be simple.
I've got a big repo which contains a project with several nicely related
subprojects in directories. Only now, we want to share some of these
subprojects with another project. I.e. they must start to live there own
life. Of course, I would like to keep the history. So, I did (git --version:
1.5.6.GIT):

	% git clone /home/git/pl.git
	% cd pl
	% git filter-branch --subdirectory-filter packages/chr HEAD

This indeed creates a nice directory holding only the contents of
packages/chr.  But, starting qgit I see that all commits, also those
that had absolutely nothing to do with this dir are still there.  Also,
all tags are still there with exactly the same SHA1 as the original.
I'd expect the tags to be rewritten such that their SHA1 refers to the
state of this single directory and its contents!?  Of course, these
tags give me access to everything, so the repository doesn't shrink
much too.

I must be missing something important ...  I found similar complaints,
but few decent answers and the few answer I did find appeared outdated.
The one at http://use.perl.org/~rjbs/journal/34411 comes closest, although
the reset --hard is no longer needed and the copying and gc-ing doesn't
help much anymore.

Should I write a tree-filter that removes all but the directory I want 
to keep?  I.e. something like this?  Feels like and overkill and I fear
I'll have a lot of empty commits left.

	'mv packages/chr .. && rm -r * && mv ../chr/* . && rmdir ../chr'

I'll be grateful for a clue!

	Cheers --- Jan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help