git filter-branch --prune-empty --tree-filter '
if [[ ! -e foo/bar ]]; then
mkdir -p foo/bar
git ls-tree --name-only $GIT_COMMIT | xargs -I files mv files foo/bar
fi'
Where foo/bar
is the new dir where your files will be placed.
Source: http://stackoverflow.com/a/4042965/1863234. Thanks to Dan Moulding.
functional git!