diff --git a/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github.md b/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github.md index 97b049d2dee3..30a25ec8ae0a 100644 --- a/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github.md +++ b/content/get-started/importing-your-projects-to-github/importing-source-code-to-github/adding-locally-hosted-code-to-github.md @@ -58,11 +58,21 @@ If you have existing source code or repositories stored locally on your computer ![Create New Repository drop-down](/assets/images/help/repository/repo-create.png) {% data reusables.command_line.open_the_multi_os_terminal %} 3. Change the current working directory to your local project. -4. Initialize the local directory as a Git repository. - ```shell - $ git init -b main - ``` +4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `master`. + + If you’re using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`. + + ``` shell + $ git init -b main + ``` + + If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`. + + ``` shell + $ git init && git branch -m main + ``` 5. Add the files in your new local repository. This stages them for the first commit. + ```shell $ git add . # Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %} @@ -95,10 +105,19 @@ If you have existing source code or repositories stored locally on your computer ![Create New Repository drop-down](/assets/images/help/repository/repo-create.png) {% data reusables.command_line.open_the_multi_os_terminal %} 3. Change the current working directory to your local project. -4. Initialize the local directory as a Git repository. - ```shell - $ git init -b main - ``` +4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `master`. + + If you’re using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`. + + ``` shell + $ git init -b main + ``` + + If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`. + + ``` shell + $ git init && git branch -m main + ``` 5. Add the files in your new local repository. This stages them for the first commit. ```shell $ git add . @@ -132,10 +151,19 @@ If you have existing source code or repositories stored locally on your computer ![Create New Repository drop-down](/assets/images/help/repository/repo-create.png) {% data reusables.command_line.open_the_multi_os_terminal %} 3. Change the current working directory to your local project. -4. Initialize the local directory as a Git repository. - ```shell - $ git init -b main - ``` +4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `master`. + + If you’re using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`. + + ``` shell + $ git init -b main + ``` + + If you’re using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git branch -m`. + + ``` shell + $ git init && git branch -m main + ``` 5. Add the files in your new local repository. This stages them for the first commit. ```shell $ git add .