1
0
mirror of synced 2025-12-22 03:16:52 -05:00

Document features and changes for phase 2.5 of master/main transition (#15745)

This commit is contained in:
Matt Pollard
2020-10-02 01:43:01 +02:00
committed by GitHub
parent 16dd6b4654
commit aa3a4edb62
80 changed files with 206 additions and 191 deletions

View File

@@ -37,7 +37,7 @@ The best way to explain subtree merges is to show by example. We will:
$ touch .gitignore
$ git add .gitignore
$ git commit -m "initial commit"
> [master (root-commit) 3146c2a] initial commit
> [main (root-commit) 3146c2a] initial commit
> 0 files changed, 0 insertions(+), 0 deletions(-)
> create mode 100644 .gitignore
```
@@ -55,29 +55,29 @@ The best way to explain subtree merges is to show by example. We will:
> Receiving objects: 100% (1732/1732), 528.19 KiB | 621 KiB/s, done.
> Resolving deltas: 100% (1086/1086), done.
> From git://github.com/octocat/Spoon-Knife
> * [new branch] master -> Spoon-Knife/master
> * [new branch] main -> Spoon-Knife/main
```
2. Merge the `Spoon-Knife` project into the local Git project. This doesn't change any of your files locally, but it does prepare Git for the next step.
If you're using Git 2.9 or above:
```shell
$ git merge -s ours --no-commit --allow-unrelated-histories spoon-knife/master
$ git merge -s ours --no-commit --allow-unrelated-histories spoon-knife/main
> Automatic merge went well; stopped before committing as requested
```
If you're using Git 2.8 or below:
```shell
$ git merge -s ours --no-commit spoon-knife/master
$ git merge -s ours --no-commit spoon-knife/main
> Automatic merge went well; stopped before committing as requested
```
3. Create a new directory called **spoon-knife**, and copy the Git history of the `Spoon-Knife` project into it.
```shell
$ git read-tree --prefix=spoon-knife/ -u spoon-knife/master
$ git read-tree --prefix=spoon-knife/ -u spoon-knife/main
```
4. Commit the changes to keep them safe.
```shell
$ git commit -m "Subtree merged in spoon-knife"
> [master fe0ca25] Subtree merged in spoon-knife
> [main fe0ca25] Subtree merged in spoon-knife
```
Although we've only added one subproject, any number of subprojects can be incorporated into a Git repository.
@@ -99,7 +99,7 @@ $ git pull -s subtree <em>remotename</em> <em>branchname</em>
For the example above, this would be:
```shell
$ git pull -s subtree spoon-knife master
$ git pull -s subtree spoon-knife main
```
### Further reading