git filter-branch --index-filter \
'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD
git ls-files -s
- lists staged files
GIT_INDEX_FILE
- WTF is this? GIT_INDEX_FILE.new
seems to be an output variable
git update-index
- --index-info Read index information from stdin. supports git ls-files -s
from http://jeffreysambells.com/2010/09/13/a-little-bit-of-git-fu
git filter-branch --index-filter 'git ls-files -s | sed "s-\t-&newdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
if test -f "$GIT_INDEX_FILE.new"; then mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE; fi' HEAD