假设我有一个包含以下目录结构的存储库:
repo/
blog/
_posts/
some-post.html
another-file.txt
我想移到存储库_posts
的顶层,因此结构如下所示:
repo/
_posts/
some-post.html
another-file.txt
这样做很简单git mv
,但是我想使历史看起来好像_posts
一直存在于仓库的根部,并且我希望能够获得some-post.html
via的全部历史git log -- _posts/some-post.html
。我想我可以使用一些魔术git filter-branch
来完成此操作,但是我还没有弄清楚该怎么做。有任何想法吗?
--index-filter
,因为它没有检查出的树。