Skip to content

Commit 2cbf00f

Browse files
authored
Expand the section on renaming to the 'main' branch. (python#687)
Expand the section on renaming to the 'main' branch by including instructions to rename local forks on GitHub.
1 parent 9b6b939 commit 2cbf00f

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

gitbootcamp.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,30 @@ You may specify more than one branch for deletion.
157157
Renaming Branch
158158
---------------
159159

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::
160+
The CPython repository's default branch was renamed from ``master`` to
161+
``main`` after the Python 3.10b1 release.
162+
163+
If you have a fork on GitHub (as described in :ref:`fork-cpython`) that was
164+
created before the rename, you should visit the GitHub page for your fork to
165+
rename the branch there. You only have to do this once. GitHub should
166+
provide you with a dialog for this. If it doesn't (or the dialog was already
167+
dismissed), you can rename the branch in your fork manually `by following
168+
these GitHub instructions <https://github.com/github/renaming#renaming-existing-branches>`__
169+
170+
After renaming the branch in your fork, you need to update any local clones
171+
as well. This only has to be done once per clone::
172+
173+
git branch -m master main
174+
git fetch origin
175+
git branch -u origin/main main
176+
git remote set-head origin -a
177+
178+
(GitHub also provides these instructions after you rename the branch.)
179+
180+
If you do not have a fork on GitHub, but rather a direct clone of the main
181+
repo created before the branch rename, you still have to update your local
182+
clones. This still only has to be done once per clone. In that case, you can
183+
rename your local branch as follows::
163184

164185
git branch -m master main
165186
git fetch upstream

0 commit comments

Comments
 (0)