I have a git repository in a directory called project:
[~/project]$ ls
a b c
I want to move everything into a subdirectory of the project directory, so it look like this:
[~/project]$ ls
subdir
[~/project]$ cd subdir
[~/project/subdir]$ ls
a b c
Normally a git mv would work, but I want to make it look as if the historical commits had always been made to that subdirectory from the beginning. Is there a way to do this?
Looks like
filter-branchdoes what I want:The
-d /tmp/whateverpart is just so it runs the commands on a tmpfs filesystem so there isn’t a bunch of disk IO.(In rare cases,
/tmpwon’t be mounted as tmpfs. You can check withmount | grep tmp.)