Skip to content

Commit 7a15463

Browse files
committed
Update adopt into existing tutorial
1 parent c52aaa1 commit 7a15463

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

docs/tutorials/adopt-existing.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Adopt the template into an existing repo
22

3-
To adopt the latest version of this template to an existing project run:
4-
```shell
5-
copier copy gh:DiamondLightSource/python-copier-template /path/to/existing-project
6-
```
3+
You can adopt this template into an existing repo by running `copier copy` in much the same way as in a new project.
74

85
This will:
96

@@ -12,9 +9,40 @@ This will:
129
- Ask if you would like to overwrite conflicting files (always choose yes)
1310
- Record the answers in the project so they can be used in later updates
1411

15-
## Conflicting Files
16-
After choosing to overwrite the conflicting files, open your project in an editor and go through the changes and any merge conflicts ensure that you have the right files and contents.
12+
:::{note}
13+
Copier will *overwrite* files with the template files. Please check the changes using `git diff` and put back anything you would like to keep from the existing project files.
14+
:::
15+
16+
## If you have a skeleton-based project
17+
18+
If you have a [python3-pip-skeleton](https://github.com/DiamondLightSource/python3-pip-skeleton) based project then it is best to adopt the `1.0.0` release of this template, then `copier update` to get to the latest. This is because `copier update` will try and merge file changes across renames done between releases, while `copier copy` cannot. This looks like:
19+
20+
```shell
21+
copier copy gh:DiamondLightSource/python-copier-template --vcs-ref=1.0.0 /path/to/existing-project
22+
git diff
23+
# Examine the changes, put back anything you want to keep
24+
git commit -m "Adopted python-copier-template 1.0.0"
25+
copier update /path/to/existing-project
26+
git diff
27+
# Examine the changes, resolve any merge conflicts
28+
git commit -m "Updated to python-copier-template x.x.x"
29+
```
30+
31+
## If you do not have a skeleton-based project
32+
33+
If you have a project with a different structure then it is best to go straight to the latest release:
34+
35+
```shell
36+
copier copy gh:DiamondLightSource/python-copier-template /path/to/existing-project
37+
git diff
38+
# Examine the changes, put back anything you want to keep
39+
git commit -m "Adopted python-copier-template x.x.x"
40+
```
1741

1842
:::{note}
19-
Copier does not touch any already existing files that do not conflict with the ones in the template. Therefore, you may end up with files in your project you no longer need such as old github workflows. These would need to be manually deleted.
43+
Copier does not touch any already existing files that do not conflict with the ones in the template. Therefore, you may end up with files in your project you no longer need such as old github workflows. These would need to be manually deleted.
2044
:::
45+
46+
## Getting started with your new structure
47+
48+
You can now [](../how-to/dev-install), and then follow some of the other [](../how-to).

0 commit comments

Comments
 (0)