Git:也是在历史中移动文件 [英] Git: move files in history too
问题描述
使用Git的工具可以在修改完整历史记录的同时将文件移动到新文件夹中,就像文件从第一次添加到那里一样?
在合并了一些回购合并之后,我想到了这一点:我将文件从几个回购站移到了一个超级回购站内的不同文件夹,但合并历史与 git rebase
和 git svn
工具,因为完全不同的文件可能会在旧位置碰撞。 所以,现在完成了这项工作:
git filter-branch --tree-filter'(ls -A; mkdir TheSubdir; echo TheSubdir)| xargs mv'
奇怪但很好:.git dir停留在它应该在的位置;也许混帐阻止它的运动?
is it possible with Git's tools to move files into a new folder while modifying its full history, as if the files had been there from their first add?
I came up on this after merging some repos together: I moved the files from several repos to distinct folders inside one "super" repo, however the merged history behaves very bad with git rebase
and git svn
tools as totally different files may collide at their old locations of course.
So now this got the job done:
git filter-branch --tree-filter '(ls -A; mkdir TheSubdir; echo TheSubdir) | xargs mv'
Strange but nice: the .git dir stays where it should; maybe git is preventing its movement somehow?
这篇关于Git:也是在历史中移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!