Skip to content

Commit acc834c

Browse files
authored
Replace CPython default branch name to main branch. (#662)
1 parent 5048d2e commit acc834c

10 files changed

+84
-71
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ our workflow that are not covered by a bot or status check are:
2424
- All discussions that are not directly related to the code in the pull request
2525
should happen on [bugs.python.org](https://bugs.python.org/)
2626
- Upon your first non-trivial pull request (which includes documentation changes),
27-
feel free to add yourself to [`Misc/ACKS`](https://github.com/python/cpython/blob/master/Misc/ACKS)
27+
feel free to add yourself to [`Misc/ACKS`](https://github.com/python/cpython/blob/main/Misc/ACKS)
2828

2929

3030
## Setting Expectations

buildbots.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ There are three ways of visualizing recent build results:
4040
https://code.google.com/archive/p/bbreport. Installing it is trivial: just add
4141
the directory containing ``bbreport.py`` to your system path so that
4242
you can run it from any filesystem location. For example, if you want
43-
to display the latest build results on the development ("master") branch,
43+
to display the latest build results on the development ("main") branch,
4444
type::
4545

4646
bbreport.py -q 3.x

committing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ to enter the public source tree. Ask yourself the following questions:
1919
we need to have a resolution there before we can merge the pull request.
2020

2121
* **Was the pull request first made against the appropriate branch?**
22-
The only branch that receives new features is ``master``, the
22+
The only branch that receives new features is ``main``, the
2323
in-development branch. Pull requests should only target bug-fix branches
2424
if an issue appears in only that version and possibly older versions.
2525

@@ -161,15 +161,15 @@ Python repositories, so you need to be careful with your workflow:
161161
You can also push these branches to a separate public repository
162162
for maintenance work before it is integrated into the main repository.
163163

164-
* **You should not commit directly into the** ``master`` **branch, or any of the maintenance branches.**
164+
* **You should not commit directly into the** ``main`` **branch, or any of the maintenance branches.**
165165
You should commit against your own feature branch, and then create a
166166
pull request.
167167

168168
* **For a small change, you can make a quick edit through the GitHub web UI.**
169169
If you choose to use the web UI, be aware that GitHub will
170170
create a new branch in the main CPython repository rather than in your fork.
171171
Delete this newly created branch after it has been merged into the
172-
``master`` branch or any of the maintenance branches. To keep the CPython
172+
``main`` branch or any of the maintenance branches. To keep the CPython
173173
repository tidy, remove the new branch within a few days.
174174

175175
Keep a fork of the main repository, since it will allow you to revert all
@@ -187,7 +187,7 @@ Seeing active branches
187187

188188
If you use ``git branch``, then you will see a :ref:`list of branches
189189
<branchstatus>`. The only branch that receives new features is
190-
``master``, the in-development branch. The other branches receive only
190+
``main``, the in-development branch. The other branches receive only
191191
bug fixes or security fixes.
192192

193193

@@ -207,15 +207,15 @@ backporting it themselves, using the backport generated by cherry_picker.py_
207207
as a starting point.
208208

209209
You can get the commit hash from the original pull request, or you can use
210-
``git log`` on the ``master`` branch. To display the 10 most recent commit
210+
``git log`` on the ``main`` branch. To display the 10 most recent commit
211211
hashes and their first line of the commit, use the following command::
212212

213213
git log -10 --oneline
214214

215215
.. _backport-pr-title:
216216

217217
You can prefix the backport pull request with the branch, and reference
218-
the pull request number from ``master``. Here is an example::
218+
the pull request number from ``main``. Here is an example::
219219

220220
[3.9] bpo-12345: Fix the Spam Module (GH-NNNN)
221221

coverity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,4 @@ Dakshesh Vyas <[email protected]>
150150

151151
.. _Coverity Connect: https://scan.coverity.com/projects/python
152152

153-
.. _coverity_model.c: https://github.com/python/cpython/blob/master/Misc/coverity_model.c
153+
.. _coverity_model.c: https://github.com/python/cpython/blob/main/Misc/coverity_model.c

devcycle.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ There is a branch for each *feature version*, whether released or not (e.g.
4444
In-development (main) branch
4545
----------------------------
4646

47-
The ``master`` branch is the branch for the next feature release; it is
47+
The ``main`` branch is the branch for the next feature release; it is
4848
under active development for all kinds of changes: new features, semantic
4949
changes, performance improvements, bug fixes.
5050

@@ -57,7 +57,7 @@ release was cut (for example, 3.4.0 final).
5757

5858
Starting with the 3.5 release, we create the release maintenance branch
5959
(e.g. 3.5) at the time we enter beta (3.5.0 beta 1). This allows
60-
feature development for the release 3.n+1 to occur within the master
60+
feature development for the release 3.n+1 to occur within the main
6161
branch alongside the beta and release candidate stabilization periods
6262
for release 3.n.
6363

gitbootcamp.rst

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ Creating and Switching Branches
103103
-------------------------------
104104

105105
.. important::
106-
Never commit directly to the ``master`` branch.
106+
Never commit directly to the ``main`` branch.
107107

108108
Create a new branch and switch to it::
109109

110-
# creates a new branch off master and switch to it
111-
git checkout -b <branch-name> master
110+
# creates a new branch off main and switch to it
111+
git checkout -b <branch-name> main
112112

113113
This is equivalent to::
114114

115-
# create a new branch from master, without checking it out
116-
git branch <branch-name> master
115+
# create a new branch from main, without checking it out
116+
git branch <branch-name> main
117117
# check out the branch
118118
git checkout <branch-name>
119119

@@ -144,7 +144,7 @@ Deleting Branches
144144

145145
To delete a **local** branch that you no longer need::
146146

147-
git checkout master
147+
git checkout main
148148
git branch -D <branch-name>
149149

150150
To delete a **remote** branch::
@@ -153,6 +153,19 @@ To delete a **remote** branch::
153153

154154
You may specify more than one branch for deletion.
155155

156+
157+
Renaming Branch
158+
---------------
159+
160+
The CPython repository's default branch was renamed from ``master`` to ``main``
161+
after the Python 3.10b1 release. If you had cloned the repository before this
162+
change, you can rename your local branch as follows::
163+
164+
git branch -m master main
165+
git fetch upstream
166+
git branch -u upstream/main main
167+
168+
156169
Staging and Committing Files
157170
----------------------------
158171

@@ -230,7 +243,7 @@ Creating a Pull Request
230243

231244
3. Click the ``compare across forks`` link.
232245

233-
4. Select the base repository: ``python/cpython`` and base branch: ``master``.
246+
4. Select the base repository: ``python/cpython`` and base branch: ``main``.
234247

235248
5. Select the head repository: ``<username>/cpython`` and head branch: the branch
236249
containing your changes.
@@ -250,14 +263,14 @@ Scenario:
250263
the upstream CPython repository.
251264

252265
Please do not try to solve this by creating a pull request from
253-
``python:master`` to ``<username>:master`` as the authors of the patches will
266+
``python:main`` to ``<username>:main`` as the authors of the patches will
254267
get notified unnecessarily.
255268

256269
Solution::
257270

258-
git checkout master
259-
git pull upstream master
260-
git push origin master
271+
git checkout main
272+
git pull upstream main
273+
git push origin main
261274

262275
.. note:: For the above commands to work, please follow the instructions found
263276
in the :ref:`checkout` section
@@ -275,11 +288,11 @@ Solution::
275288

276289
git checkout some-branch
277290
git fetch upstream
278-
git merge upstream/master
291+
git merge upstream/main
279292
git push origin some-branch
280293

281294
You may see error messages like "CONFLICT" and "Automatic merge failed;" when
282-
you run ``git merge upstream/master``.
295+
you run ``git merge upstream/main``.
283296

284297
When it happens, you need to resolve conflict. See these articles about resolving conflicts:
285298

@@ -308,7 +321,7 @@ Solution:
308321

309322
.. code-block:: bash
310323

311-
git checkout $(git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" master)
324+
git checkout $(git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" main)
312325
git apply /path/to/issueNNNN-git.patch
313326

314327
If the patch still won't apply, then a patch tool will not be able to
@@ -321,7 +334,7 @@ Solution:
321334
5. If the patch was applied to an old revision, it needs to be updated and
322335
merge conflicts need to be resolved::
323336

324-
git rebase master
337+
git rebase main
325338
git mergetool
326339

327340
6. Push the changes and open a pull request.
@@ -388,7 +401,7 @@ Pull requests can be accepted and merged by a Python Core Developer.
388401
bpo-12345: Improve the spam module (#777)
389402

390403
* Improve the spam module
391-
* merge from master
404+
* merge from main
392405
* adjust code based on review comment
393406
* rebased
394407

@@ -402,7 +415,7 @@ Backporting Merged Changes
402415
--------------------------
403416

404417
A pull request may need to be backported into one of the maintenance branches
405-
after it has been accepted and merged into ``master``. It is usually indicated
418+
after it has been accepted and merged into ``main``. It is usually indicated
406419
by the label ``needs backport to X.Y`` on the pull request itself.
407420

408421
Use the utility script
@@ -411,10 +424,10 @@ from the `core-workflow <https://github.com/python/core-workflow>`_
411424
repository to backport the commit.
412425

413426
The commit hash for backporting is the squashed commit that was merged to
414-
the ``master`` branch. On the merged pull request, scroll to the bottom of the
427+
the ``main`` branch. On the merged pull request, scroll to the bottom of the
415428
page. Find the event that says something like::
416429

417-
<core_developer> merged commit <commit_sha1> into python:master <sometime> ago.
430+
<core_developer> merged commit <commit_sha1> into python:main <sometime> ago.
418431

419432
By following the link to ``<commit_sha1>``, you will get the full commit hash.
420433

@@ -459,12 +472,12 @@ items like updating ``Misc/ACKS``.
459472

460473
.. _Allow edits from maintainers: https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/
461474

462-
To edit an open pull request that targets ``master``:
475+
To edit an open pull request that targets ``main``:
463476

464477
1. In the pull request page, under the description, there is some information
465478
about the contributor's forked CPython repository and branch name that will be useful later::
466479

467-
<contributor> wants to merge 1 commit into python:master from <contributor>:<branch_name>
480+
<contributor> wants to merge 1 commit into python:main from <contributor>:<branch_name>
468481

469482
2. Fetch the pull request, using the :ref:`git pr <git_pr>` alias::
470483

@@ -473,13 +486,13 @@ To edit an open pull request that targets ``master``:
473486
This will checkout the contributor's branch at ``<pr_number>``.
474487

475488
3. Make and commit your changes on the branch. For example, merge in changes
476-
made to ``master`` since the PR was submitted (any merge commits will be
489+
made to ``main`` since the PR was submitted (any merge commits will be
477490
removed by the later ``Squash and Merge`` when accepting the change):
478491

479492
.. code-block:: bash
480493
481494
git fetch upstream
482-
git merge upstream/master
495+
git merge upstream/main
483496
git add <filename>
484497
git commit -m "<message>"
485498

index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ instructions please see the :ref:`setup guide <setup>`.
5252

5353
5. Create a new branch where your work for the issue will go, e.g.::
5454

55-
git checkout -b fix-issue-12345 master
55+
git checkout -b fix-issue-12345 main
5656

5757
If an issue does not already exist, please `create it
5858
<https://bugs.python.org/>`_. Trivial issues (e.g. typo fixes) do not
@@ -98,7 +98,7 @@ Status of Python branches
9898
+------------------+--------------+-------------+----------------+----------------+-----------------------+
9999
| Branch | Schedule | Status | First release | End-of-life | Release manager |
100100
+==================+==============+=============+================+================+=======================+
101-
| master | :pep:`619` | features | *2021-10-04* | *TBD* | Pablo Galindo Salgado |
101+
| main | :pep:`619` | features | *2021-10-04* | *TBD* | Pablo Galindo Salgado |
102102
+------------------+--------------+-------------+----------------+----------------+-----------------------+
103103
| 3.9 | :pep:`596` | bugfix | 2020-10-05 | *TBD* | Łukasz Langa |
104104
+------------------+--------------+-------------+----------------+----------------+-----------------------+
@@ -111,7 +111,7 @@ Status of Python branches
111111

112112
.. Remember to update the end-of-life table in devcycle.rst.
113113
114-
The master branch is currently the future Python 3.10, and is the only
114+
The main branch is currently the future Python 3.10, and is the only
115115
branch that accepts new features. The latest release for each Python
116116
version can be found on the `download page <https://www.python.org/downloads/>`_.
117117

@@ -244,7 +244,7 @@ Key Resources
244244
* `Buildbot status`_
245245
* Source code
246246
* `Browse online <https://github.com/python/cpython/>`_
247-
* `Snapshot of the *master* branch <https://github.com/python/cpython/archive/master.zip>`_
247+
* `Snapshot of the *main* branch <https://github.com/python/cpython/archive/main.zip>`_
248248
* `Daily OS X installer <http://buildbot.python.org/daily-dmg/>`_
249249
* PEPs_ (Python Enhancement Proposals)
250250
* :doc:`help`
@@ -330,7 +330,7 @@ Full Table of Contents
330330
appendix
331331

332332
.. _Buildbot status: https://www.python.org/dev/buildbot/
333-
.. _Misc directory: https://github.com/python/cpython/tree/master/Misc
333+
.. _Misc directory: https://github.com/python/cpython/tree/main/Misc
334334
.. _PEPs: https://www.python.org/dev/peps/
335335
.. _python.org maintenance: https://pythondotorg.readthedocs.io/
336336
.. _Python: https://www.python.org/

pullrequest.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ You should have already :ref:`set up your system <setup>`,
7575

7676
* Create a new branch in your local clone::
7777

78-
git checkout -b <branch-name> upstream/master
78+
git checkout -b <branch-name> upstream/main
7979

8080
* Make changes to the code, and use ``git status`` and ``git diff`` to see them.
8181

@@ -122,12 +122,12 @@ You should have already :ref:`set up your system <setup>`,
122122
there are merge conflicts, git will warn you about this and enter conflict
123123
resolution mode. See :ref:`resolving-merge-conflicts` below.
124124

125-
* If time passes and there are merge conflicts with the master branch, GitHub
125+
* If time passes and there are merge conflicts with the main branch, GitHub
126126
will show a warning to this end and you may be asked to address this. Merge
127-
the changes from the master branch while resolving the conflicts locally::
127+
the changes from the main branch while resolving the conflicts locally::
128128

129129
git checkout <branch-name>
130-
git pull upstream master # pull = fetch + merge
130+
git pull upstream main # pull = fetch + merge
131131
# resolve conflicts: see "Resolving Merge Conflicts" below
132132
git push origin <branch-name>
133133

setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ to build.
280280

281281
.. _this documentation: https://cpython-core-tutorial.readthedocs.io/en/latest/build_cpython_windows.html
282282
.. _Visual Studio 2017: https://www.visualstudio.com/
283-
.. _readme: https://github.com/python/cpython/blob/master/PCbuild/readme.txt
283+
.. _readme: https://github.com/python/cpython/blob/main/PCbuild/readme.txt
284284
.. _PCbuild directory: https://github.com/python/cpython/tree/2.7/PCbuild/
285285
.. _2.7 readme: https://github.com/python/cpython/blob/2.7/PCbuild/readme.txt
286286
.. _PC/VS9.0 directory: https://github.com/python/cpython/tree/2.7/PC/VS9.0/

0 commit comments

Comments
 (0)