I have a git-repo in Azure DevOps that I want to use as a template for starting new repos, but without the commit history of the original. GitHub has this nice feature, however I can't find a good approach in DevOps. Is the only way to clone it, remove .git and bind it to a new empty repo?
2 Answers
There is no out of the box solution on Azure Repos but you can use this workaround (Using a git repository as the base of a new project):
Instead of doing a full clone only to delete the .git directory again, you can only retrieve the archive of the repository you want to start from.
$ 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}."
I am afraid there is currently no such feature as Creating a template repository
in Azure devops.
As a workaround, because there is a feature to create a template repository in github, so we can first import the repo from azure devops to github.
Then create a template repo in github, and finally import the created template repo into azure devops.
In addition , I think what you want is a good idea! You can post this feature request on our UserVoice site , which is our main forum for product suggestions. The product team would provide the updates if they view it. Thank you for helping us build a better Azure DevOps.