1
0
mirror of synced 2025-12-20 02:19:14 -05:00

Fix for blank lines around code fences (#38255)

This commit is contained in:
Grace Park
2023-06-26 10:21:48 -07:00
committed by GitHub
parent a4913b5935
commit a8a6e4554a
272 changed files with 1552 additions and 2 deletions

View File

@@ -29,16 +29,21 @@ The best way to explain subtree merges is to show by example. We will:
{% data reusables.command_line.open_the_multi_os_terminal %}
2. Create a new directory and navigate to it.
```shell
mkdir test
cd test
```
3. Initialize a new Git repository.
```shell
$ git init
> Initialized empty Git repository in /Users/octocat/tmp/test/.git/
```
4. Create and commit a new file.
```shell
$ touch .gitignore
$ git add .gitignore
@@ -51,6 +56,7 @@ The best way to explain subtree merges is to show by example. We will:
## Adding a new repository as a subtree
1. Add a new remote URL pointing to the separate project that we're interested in.
```shell
$ git remote add -f spoon-knife https://github.com/octocat/Spoon-Knife.git
> Updating spoon-knife
@@ -63,25 +69,32 @@ The best way to explain subtree merges is to show by example. We will:
> From https://github.com/octocat/Spoon-Knife
> * [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/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/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/main
> fatal: refusing to merge unrelated histories
```
4. Commit the changes to keep them safe.
```shell
$ git commit -m "Subtree merged in spoon-knife"
> [main fe0ca25] Subtree merged in spoon-knife

View File

@@ -21,11 +21,13 @@ If you create a new clone of the repository, you won't lose any of your Git hist
2. Change the current working directory to the location where you want to create your new repository.
4. Clone the repository that contains the subfolder.
```shell
git clone https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY-NAME
```
4. Change the current working directory to your cloned repository.
```shell
cd REPOSITORY-NAME
```
@@ -65,11 +67,13 @@ If you create a new clone of the repository, you won't lose any of your Git hist
{% endtip %}
8. Add a new remote name with the URL you copied for your repository. For example, `origin` or `upstream` are two common choices.
```shell
git remote add origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY-NAME.git
```
9. Verify that the remote URL was added with your new repository name.
```shell
$ git remote -v
# Verify new remote URL
@@ -78,6 +82,7 @@ If you create a new clone of the repository, you won't lose any of your Git hist
```
10. Push your changes to the new repository on {% data variables.product.product_name %}.
```shell
git push -u origin BRANCH-NAME
```