【发布时间】:2020-08-10 15:42:06
【问题描述】:
我在 Azure DevOps 中有一个 git-repo,我想将其用作启动新存储库的模板,但没有原始存储库的提交历史记录。 GitHub has this nice feature,但是我在 DevOps 中找不到好的方法。是克隆它、删除 .git 并将其绑定到新的空仓库的唯一方法吗?
【问题讨论】:
标签: git azure-devops azure-repos
我在 Azure DevOps 中有一个 git-repo,我想将其用作启动新存储库的模板,但没有原始存储库的提交历史记录。 GitHub has this nice feature,但是我在 DevOps 中找不到好的方法。是克隆它、删除 .git 并将其绑定到新的空仓库的唯一方法吗?
【问题讨论】:
标签: git azure-devops azure-repos
Azure Repos 上没有开箱即用的解决方案,但您可以使用此解决方法 (Using a git repository as the base of a new project):
与其进行完全克隆只是为了再次删除 .git 目录, 您只能检索要启动的存储库的存档 来自。
$ mkdir new-project/
$ cd new-project/
$ git archive --remote="${giturl}" HEAD | tar -x
$ git init
$ git add -A
$ git commit -m "Staring off with revision ${rev} of repository ${repo}."
【讨论】:
恐怕Azure devops中目前还没有Creating a template repository这样的功能。
作为一种解决方法,因为在 github 中有创建模板存储库的功能,所以我们可以先将 repo 从 azure devops 导入到 github。
然后在github中创建一个模板repo,最后将创建的模板repo导入到azure devops中。
另外,我认为你想要的是一个好主意!您可以在我们的UserVoice 网站上发布此功能请求,这是我们产品建议的主要论坛。如果产品团队查看更新,他们将提供更新。感谢您帮助我们构建更好的 Azure DevOps。
【讨论】: