【问题标题】:How can I rewrite history so that all files are in a subdirectory?如何重写历史记录以使所有文件都在子目录中?
【发布时间】:2015-08-04 11:50:47
【问题描述】:

我的问题是How can I rewrite history so that all files, except the ones I already moved, are in a subdirectory?的简化版

我在我的 IDE 中创建了一个 repo 并提交了一个项目。现在所有 repo 的根映射到项目根并且所有文件都在根中。如何将项目移动到其自己的子目录中,以便在同一个 repo 中容纳其他项目,并重写历史记录以看起来一切都已正确开始?

【问题讨论】:

    标签: git


    【解决方案1】:

    这对我有用

    git filter-branch --tree-filter 'mkdir NEW_FOLDER; git ls-tree --name-only $GIT_COMMIT | xargs -I files mv files NEW_FOLDER'
    

    NEW_FOLDER 是新的目标子目录。

    【讨论】:

      猜你喜欢
      • 2014-04-05
      • 2011-05-01
      • 2012-10-07
      • 2020-11-07
      • 1970-01-01
      • 2012-04-25
      • 1970-01-01
      • 2020-05-30
      相关资源
      最近更新 更多