Elijah Newren <newren@xxxxxxxxx> writes: > +extract_files_subtree () { > + git fast-export --no-data HEAD -- files_subtree/ | > + sed -e "s%\([0-9a-f]\{40\} \)files_subtree/%\1%" | > + git fast-import --force --quiet > +} Clever, if a bit filthy ;-). We expect to see something like M 100644 dead...beef files_subtree/bar M 100755 c0f.....fee files_subtree/foo in the --no-data output, and the assumption here is that 40-hex followed by " files_subtree/" would never appear anywhere in the stream other than these tree dump, so the sed script can rewrite the above to M 100644 dead...beef bar M 100755 c0f.....fee foo by getting rid of the leading directory name (plus the slash at the end). Thanks.