Joined May 2013
·
Posted to
Relocate the entire history of a Git repository
over 1 year
ago
Another update: Don't read files from a subshell. Instead, use "find ... -exec" (solves issues with files that contain whitespaces).
Old version:
git filter-branch --tree-filter 'mkdir html && mv $(find . -mindepth 1 -maxdepth 1 | grep -v "^./.git" | grep -v "^./html$") html/' HEAD
Posted to
Relocate the entire history of a Git repository
over 1 year
ago
Small update: I removed the end-of-line marker on of the greps, to make sure that ".git" as well as ".gitignore" are not moved.
Achievements
70 Karma
9,525 Total ProTip Views
Python
Would you expect anything less? Have at least one original repo where Python is the dominant language
Forked
Have a project valued enough to be forked by someone else
Charity
Fork and commit to someone's open source project in need
Mongoose
Have at least one original repo where Ruby is the dominant language
Raven
Have at least one original repo where some form of shell script is the dominant language
Hi Michiel!
I'm not sure what didn't work for you. It certainly takes a while to process, however it is tested and works fine.
I would be careful with the queries you mentioned as I see quite a few issues:
However, I see that the original queries that I suggested could be well optimized. Instead of creating temporary tables, a JOIN should work out well and be much faster. In any case, you need to make a connection between sysfile and sysfile_reference if you're cleaning up in both tables.