I have a simple repository with linear history where work was done in the root folder. I would like to rewrite history so that all the work from every commit looks like it happened in the /server
directory instead of the root directory.
In the end, the repository should have a single folder called server
in its root, with all my project's files and folders now (and at all points of history before) located in /server
.
git filter-branch --commit-filter '
toptree=`printf "040000 tree %s\\tserver" $1 | git mktree`
shift
git commit-tree $toptree "$@"
' -- --branches