Skip to content

Instantly share code, notes, and snippets.

@larsxschneider
Created February 10, 2018 16:20
Show Gist options
  • Save larsxschneider/53db48ee83193f19428d70474f429c2d to your computer and use it in GitHub Desktop.
Save larsxschneider/53db48ee83193f19428d70474f429c2d to your computer and use it in GitHub Desktop.
Move all files and directories in a Git repo one level down
# Move all files and directories in a Git repo one level down into the "Core" directory
git filter-branch --index-filter 'git read-tree --prefix="Core/" $GIT_COMMIT && git ls-files | sed "s/\/.*//" | sort | uniq | grep -v "^Core" | xargs -L1 git rm -r --cached > /dev/null'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment