mtc*_*lot 8 git azure-devops azure-repos
我在 Azure DevOps 中有一个 git-repo,我想将其用作启动新存储库的模板,但没有原始存储库的提交历史记录。GitHub 有这个不错的功能,但是我在 DevOps 中找不到好的方法。克隆它、删除 .git 并将其绑定到新的空存储库的唯一方法是吗?
Azure Repos 上没有开箱即用的解决方案,但您可以使用此解决方法(使用 git 存储库作为新项目的基础):
您只能检索要从中启动的存储库的存档,而不是仅执行完整克隆以再次删除 .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}."
Run Code Online (Sandbox Code Playgroud)