Rewriting Git history to place all work in a subfolder instead of root

Solution 1:

git filter-branch --commit-filter '  
            toptree=`printf "040000 tree %s\\tserver" $1 | git mktree`
            shift
            git commit-tree $toptree "$@"
    ' -- --branches

Solution 2:

You are looking for git filter-repo. This is just the kind of thing it was written to do; see #3 in the rationale section of the readme.

https://github.com/newren/git-filter-repo#design-rationale-behind-filter-repo