Skip to content

Commit 458f7b7

Browse files
committed
Explicitly guide the renaming of the branch
1 parent bde7d5c commit 458f7b7

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

en/deploy/README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,27 @@ Initialized empty Git repository in ~/djangogirls/.git/
2929
$ git config --global user.name "Your Name"
3030
$ git config --global user.email you@example.com
3131
```
32-
3332
Initializing the git repository is something we need to do only once per project (and you won't have to re-enter the username and email ever again).
3433

34+
### Adjusting your branch name
35+
36+
If the version of git that you are using is older than **2.28**, you will need to change the name of your branch to "main". To determine the version of git, please enter the following command:
37+
38+
{% filename %}command-line{% endfilename %}
39+
```
40+
$ git --version
41+
git version 2.xx...
42+
```
43+
44+
Only if the second number of the version, shown as "xx" above, is less than 28, will you need to enter the following command to rename your branch. If it is 28 or higher, please continue to "Ignoring files". As in "Initializing", this is something we need to do only once per project, as well as only when your version of git is less than 2.28:
45+
46+
{% filename %}command-line{% endfilename %}
47+
```
48+
$ git branch -M main
49+
```
50+
51+
### Ignoring files
52+
3553
Git will track changes to all the files and folders in this directory, but there are some files we want it to ignore. We do this by creating a file called `.gitignore` in the base directory. Open up your editor and create a new file with the following contents:
3654

3755
{% filename %}.gitignore{% endfilename %}
@@ -130,7 +148,7 @@ On the next screen, you'll be shown your repo's clone URL, which you will use in
130148

131149
Now we need to hook up the Git repository on your computer to the one up on GitHub.
132150

133-
Type the following into your console (replace `<your-github-username>` with the username you entered when you created your GitHub account, but without the angle-brackets -- the URL should match the clone URL you just saw). Note that your choice of "main" or "master" in the Installation chapter will determine the final word in the second command.
151+
Type the following into your console (replace `<your-github-username>` with the username you entered when you created your GitHub account, but without the angle-brackets -- the URL should match the clone URL you just saw).
134152

135153
{% filename %}command-line{% endfilename %}
136154
```

en/deploy/install_git.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ data-collapse=true ces-->
77

88
You can download Git from [git-scm.com](https://git-scm.com/). You can hit "next" on all steps except for two: in the step where it asks to choose your editor, you should pick Nano, and in the step entitled "Adjusting your PATH environment", choose "Use Git and optional Unix tools from the Windows Command Prompt" (the bottom option). Other than that, the defaults are fine. Checkout Windows-style, commit Unix-style line endings is good.
99

10-
An option while installing git-scm may be to choose "master" or "main" for your default branch. The use of "master" as the default branch has been deprecated by the global developer community — please see https://github.com/github/renaming for a discussion on the choices. Which option you choose will be important during the later "Deployment" section of this tutorial.
10+
During installation, if you are presented with the option of "Adjusting the name of the inita branch in new repositories", please choose to "Ovveride the default" and use "main". This will align your installation of git with the broad direction of the global developer community, and the "main" branch will be used throught the remainder of this tutrial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
1111

1212
Do not forget to restart the command prompt or PowerShell after the installation finished successfully.
1313
<!--endsec-->
@@ -17,6 +17,8 @@ data-collapse=true ces-->
1717

1818
Download Git from [git-scm.com](https://git-scm.com/) and follow the instructions.
1919

20+
During installation, if you are presented with the option of "Adjusting the name of the inita branch in new repositories", please choose to "Ovveride the default" and use "main". This will align your installation of git with the broad direction of the global developer community, and the "main" branch will be used throught the remainder of this tutrial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
21+
2022
> **Note** If you are running OS X 10.6, 10.7, or 10.8, you will need to install the version of git from here: [Git installer for OS X Snow Leopard](https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-snow-leopard.dmg/download)
2123
2224
<!--endsec-->
@@ -29,6 +31,15 @@ data-collapse=true ces-->
2931
$ sudo apt install git
3032
```
3133

34+
### Adjusting your default branch name
35+
36+
This will align your installation of git with the broad direction of the global developer community, and the "main" branch will be used throught the remainder of this tutrial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
37+
38+
{% filename %}command-line{% endfilename %}
39+
```
40+
$ git config --global --add init.defaultBranch main
41+
```
42+
3243
<!--endsec-->
3344

3445
<!--sec data-title="Installing Git: Fedora" data-id="git_install_fedora"
@@ -39,6 +50,15 @@ data-collapse=true ces-->
3950
$ sudo dnf install git
4051
```
4152

53+
### Adjusting your default branch name
54+
55+
This will align your installation of git with the broad direction of the global developer community, and the "main" branch will be used throught the remainder of this tutrial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
56+
57+
{% filename %}command-line{% endfilename %}
58+
```
59+
$ git config --global --add init.defaultBranch main
60+
```
61+
4262
<!--endsec-->
4363

4464
<!--sec data-title="Installing Git: openSUSE" data-id="git_install_openSUSE"
@@ -49,4 +69,13 @@ data-collapse=true ces-->
4969
$ sudo zypper install git
5070
```
5171

72+
### Adjusting your default branch name
73+
74+
This will align your installation of git with the broad direction of the global developer community, and the "main" branch will be used throught the remainder of this tutrial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
75+
76+
{% filename %}command-line{% endfilename %}
77+
```
78+
$ git config --global --add init.defaultBranch main
79+
```
80+
5281
<!--endsec-->

0 commit comments

Comments
 (0)