Custom groups and instance level project templates retain commit history and pipelines
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "regression" or "type::bug" label:
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug
and verify the issue you're about to submit isn't a duplicate.
--->
### Summary
Custom group and instance level project templates rely on cloning a source repository to be used as a base for a project.
However, these templates clone the source project and _retain_ the commit history, including pipelines.
[Built-in templates](https://gitlab.com/gitlab-org/project-templates) **_do not_** retain their commit history and pipelines.
### Steps to reproduce
1. Create a project from a template at the instance or group level.
1. Observe the project history
### Example Project
#### Group template
https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/created-using-project-template-test/ was created from template: https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/project-template-test/
Of note:
- [Commit history](https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/created-using-project-template-test/-/commits/main) includes all commits from source template.
- [Pipelines history](https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/created-using-project-template-test/-/pipelines) includes all pipelines from source template.
The same behaviour is true for custom instance-level project templates.
#### Built in templates
- [Commit history](https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/created-from-ruby-on-rails-instance-template/-/commits/master) does *not* include history, but links to source template. See [relevant commit](https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/created-from-ruby-on-rails-instance-template/-/commit/07b712c4883bd867c80582b7a8d15495cccaaa2e) points to https://gitlab.com/gitlab-org/project-templates/rails
### What is the current *bug* behavior?
Custom group and instance level templates import all history and CI pipelines from the source project.
### What is the expected *correct* behavior?
Custom group and instance level project templates act consistently with built-in templates and squash history into a single commit. CI pipelines are not imported.
### Relevant logs and/or screenshots
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->
### Output of checks
This bug happens on GitLab.com
#### Results of GitLab environment info
<!-- Input any relevant GitLab environment information if needed. -->
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
</pre>
</details>
#### Results of GitLab application Check
<!-- Input any relevant GitLab application check information if needed. -->
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:check SANITIZE=true`)
(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true`)
(we will only investigate if the tests are passing)
</pre>
</details>
### Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
#### Workaround(s)
Squash commits on either the source project after making changes, or projects created using the template. See [an example project for this looks](https://gitlab.com/Lyle-Ephemeral-Test-Group/project-templates/squashing-commits-on-this-project/-/commits/main). To do this you can run the one-liner `git reset $(git commit-tree HEAD^{tree} -m "A new start")` suggested in https://stackoverflow.com/questions/1657017/how-to-squash-all-git-commits-into-one and `git push -f` to force push the result. This will *not* clean up pipelines from the source project if they are present.
issue