Skip to content

Commit 328193f

Browse files
authored
Merge pull request #1742 from rgs258/patch-1
Fix #1676: Change master to main
2 parents 2558b22 + a4ba498 commit 328193f

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

en/deploy/README.md

Lines changed: 24 additions & 6 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 %}
@@ -84,7 +102,7 @@ It's a good idea to use a `git status` command before `git add` or whenever you
84102
{% filename %}command-line{% endfilename %}
85103
```
86104
$ git status
87-
On branch master
105+
On branch main
88106
89107
No commits yet
90108
@@ -130,12 +148,12 @@ 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):
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
```
137155
$ git remote add origin https://github.com/<your-github-username>/my-first-blog.git
138-
$ git push -u origin master
156+
$ git push -u origin main
139157
```
140158

141159
When you push to GitHub, you'll be asked for your GitHub username and password (either right there in the command-line window or in a pop-up window), and after entering credentials you should see something like this:
@@ -146,8 +164,8 @@ Counting objects: 6, done.
146164
Writing objects: 100% (6/6), 200 bytes | 0 bytes/s, done.
147165
Total 3 (delta 0), reused 0 (delta 0)
148166
To https://github.com/ola/my-first-blog.git
149-
* [new branch] master -> master
150-
Branch master set up to track remote branch master from origin.
167+
* [new branch] main -> main
168+
Branch main set up to track remote branch main from origin.
151169
```
152170

153171
<!--TODO: maybe do ssh keys installs in install party, and point ppl who dont have it to an extension -->

en/deploy/install_git.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ 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+
During installation, if you are presented with the option of "Adjusting the name of the initial branch in new repositories", please choose to "Override 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 through the remainder of this tutorial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
11+
1012
Do not forget to restart the command prompt or PowerShell after the installation finished successfully.
1113
<!--endsec-->
1214

@@ -15,6 +17,8 @@ data-collapse=true ces-->
1517

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

20+
During installation, if you are presented with the option of "Adjusting the name of the initial branch in new repositories", please choose to "Override 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 through the remainder of this tutorial. Please see https://sfconservancy.org/news/2020/jun/23/gitbranchname/ and https://github.com/github/renaming for further discussion of this subject.
21+
1822
> **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)
1923
2024
<!--endsec-->
@@ -27,6 +31,15 @@ data-collapse=true ces-->
2731
$ sudo apt install git
2832
```
2933

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 through the remainder of this tutorial. 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+
3043
<!--endsec-->
3144

3245
<!--sec data-title="Installing Git: Fedora" data-id="git_install_fedora"
@@ -37,6 +50,15 @@ data-collapse=true ces-->
3750
$ sudo dnf install git
3851
```
3952

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 through the remainder of this tutorial. 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+
4062
<!--endsec-->
4163

4264
<!--sec data-title="Installing Git: openSUSE" data-id="git_install_openSUSE"
@@ -47,4 +69,13 @@ data-collapse=true ces-->
4769
$ sudo zypper install git
4870
```
4971

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 through the remainder of this tutorial. 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+
5081
<!--endsec-->

0 commit comments

Comments
 (0)