@@ -27,34 +27,21 @@ git remote add java-repo-tools git@github.com:GoogleCloudPlatform/java-repo-tool
2727git fetch java-repo-tools master
2828```
2929
30- To make it easier to push changes back upstream, create a new branch.
31-
32- ```
33- git checkout -b java-repo-tools java-repo-tools/master
34- ```
35-
3630We can then go back to the ` my-java-samples ` code and prepare a Pull Request to
37- add the ` java-repo-tools ` code in a subtree.
38-
39- ```
40- git checkout master
41- # Making a new branch ia optional, but recommended to send a pull request to
42- # start using java-repo-tools.
43- git checkout -b use-java-repo-tools
44- ```
45-
46- So that we can pull future updates from the ` java-repo-tools ` repository, we
47- merge histories. This way we won't get unnecessary conflicts when pulling changes
48- in.
31+ add the ` java-repo-tools ` code in a subtree. Making a new branch is optional, but
32+ recommended so that you can more easily send a pull request to start using
33+ ` java-repo-tools ` .
4934
5035```
51- git merge -s ours --no-commit java-repo-tools/master
36+ git checkout -b use- java-repo-tools origin /master
5237```
5338
54- Finally, read the ` java-repo-tools ` into a subtree.
39+ Finally, read the ` java-repo-tools ` into a subtree. So that you can pull future
40+ updates from the ` java-repo-tools ` repository, this command will merge histories.
41+ This way prevents unnecessary conflicts when pulling changes in.
5542
5643```
57- git read-tree --prefix=java-repo-tools/ -u java-repo-tools
44+ git subtree add --prefix=java-repo-tools java-repo-tools master
5845```
5946
6047Now all the content of ` java-repo-tools ` will be in the ` java-repo-tools/ `
@@ -143,13 +130,14 @@ Pull Request as you would in the normal flow.
143130What if you make changes in your repository and now want to push them upstream?
144131
145132Assuming you just commited changes in the ` java-repo-tools/ ` directory of your
146- ` my-main-branch ` , to merge the changes into the local ` java-repo-tools ` branch,
147- we need to cherry pick this commit using the subtree strategy. It will ignore
148- any changes to file not in the ` java-repo-tools/ ` directory .
133+ ` my-main-branch ` , to split the ` java-repo-tools ` changes into their own branch.
134+ The first time using the ` subtree ` command, we may need to use the ` --rejoin `
135+ argument .
149136
150137```
151- git checkout java-repo-tools
152- git cherry-pick -x --strategy=subtree my-main-branch
138+ git subtree split --prefix=java-repo-tools -b java-repo-tools-update-from-java-docs-samples
139+ git checkout java-repo-tools-update-from-java-docs-samples
140+ git push java-repo-tools java-repo-tools-update-from-java-docs-samples
153141```
154142
155143After you have committed all the changes you want to your ` java-repo-tools `
0 commit comments