【问题标题】:github: how to make it so that the clone project tree is one level deeper?github:如何使克隆项目树更深一层?
【发布时间】:2015-09-02 18:06:10
【问题描述】:

我在 /PT 下有一个本地软件项目。当我将代码提交到 githib 时,它会作为 project-1.9 提交,并在其中创建 PT 目录。

我想这样当有人克隆项目 https://github.com/company/project-1.9.git 时,它会克隆到本地目录 PT 而不是 project-1.9/PT

有人知道这样做的方法吗?有办法吗?

【问题讨论】:

  • 使用 HTTPS 克隆 URL 按钮时的 url 是什么?

标签: git github subdirectory


【解决方案1】:

如果该 repo project-1.9 只有 PT 文件夹,一种方法是使用以下命令重新组织数据:

cd /local/clone/of/project-1.9
git mv PT/* .
git rm PT/
git commit -m "Move everything on top root folder of the repo"
git push

然后git clone https://github.com/company/project-1.9.git PT 将克隆PT 本地文件夹中的所有内容。


但如果PT 只是project-1.9 中的众多根文件夹之一,那么最好:

由于PT 是自己的repo,所以可以直接克隆:

git clone https://github.com/company/PT

这会给你一个 PT 文件夹,其中直接包含 PT 内容。

【讨论】:

    猜你喜欢
    • 2013-07-12
    • 2018-11-23
    • 2021-12-21
    • 2016-11-30
    • 1970-01-01
    • 2010-12-09
    • 2016-12-05
    • 2021-06-02
    • 1970-01-01
    相关资源
    最近更新 更多