Skip to content

Instantly share code, notes, and snippets.

@JonWallsten
Created July 31, 2018 18:04
Show Gist options
  • Save JonWallsten/cd0f496312dbcc89b06e98831cc37ae5 to your computer and use it in GitHub Desktop.
Save JonWallsten/cd0f496312dbcc89b06e98831cc37ae5 to your computer and use it in GitHub Desktop.
[GIT] Move root files into subfolder and preserve history
git filter-branch --index-filter 'git ls-files -s | sed "s-\t\"*-&[INSERT_PATH_HERE]/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' [INSERT_COMMIT_HASH_HERE]..HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment