Skip to content

Commit 5e52f93

Browse files
jaracoezio-melottiCAM-Gerlach
authored
Prefer upstream for main (#943)
* Update docs to configure 'main' to pull from 'upstream'. Ref python/core-workflow#475. * Quote 'main'. Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> * Direct 'upstream' push to the user's fork. Now pull comes from upstream and push goes to origin. * Apply the changes also to the git boot camp. * Prefer https for upstream fetch. Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Update expectations and sync guidance for d7e9065. Remove superfluous .git from https. Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
1 parent c4fbdc9 commit 5e52f93

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

getting-started/git-boot-camp.rst

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,29 @@ You will only need to do this once.
4747
Cloning a Forked CPython Repository
4848
-----------------------------------
4949

50-
You will only need to do this once. From your command line::
50+
You will only need to do this once per machine. From your command line::
5151

5252
git clone git@github.com:<username>/cpython.git
5353

5454
It is also recommended to configure an ``upstream`` remote repository::
5555

5656
cd cpython
57-
git remote add upstream git@github.com:python/cpython.git
57+
git remote add upstream https://github.com/python/cpython
5858

5959
You can also use SSH-based or HTTPS-based URLs.
6060

61+
Configure the Remotes
62+
---------------------
63+
64+
Configure ``git`` to pull ``main`` from the ``upstream`` remote::
65+
66+
git config --local branch.main.remote upstream
67+
68+
Since one should never attempt to push to ``upstream``, configure
69+
``git`` to push always to ``origin``::
70+
71+
git remote set-url --push upstream git@github.com:<username>/cpython.git
72+
6173
Listing the Remote Repositories
6274
-------------------------------
6375

@@ -70,8 +82,15 @@ and ``upstream`` pointing to the official CPython repository::
7082

7183
origin git@github.com:<username>/cpython.git (fetch)
7284
origin git@github.com:<username>/cpython.git (push)
73-
upstream git@github.com:python/cpython.git (fetch)
74-
upstream git@github.com:python/cpython.git (push)
85+
upstream https://github.com/python/cpython (fetch)
86+
upstream git@github.com:<username>/cpython.git (push)
87+
88+
To verify the upstream for ``main``::
89+
90+
git config branch.main.remote
91+
92+
It should emit ``upstream``, indicating to track/pull changes for ``main`` from the
93+
``upstream`` remote.
7594

7695

7796
.. _set-up-name-email:

getting-started/setup-building.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The CPython repo is hosted on GitHub. To get a copy of the source code you shoul
6060
:ref:`fork the Python repository on GitHub <fork-cpython>`, :ref:`create a local
6161
clone of your personal fork, and configure the remotes <clone-your-fork>`.
6262

63-
You will only need to execute these steps once:
63+
You will only need to execute these steps once per machine:
6464

6565
1. Go to https://github.com/python/cpython.
6666

@@ -79,15 +79,26 @@ You will only need to execute these steps once:
7979
6. Configure an ``upstream`` remote::
8080

8181
$ cd cpython
82-
$ git remote add upstream git@github.com:python/cpython.git
82+
$ git remote add upstream https://github.com/python/cpython
8383

84-
7. Verify that your setup is correct::
84+
7. Configure ``git`` to pull ``main`` from the ``upstream`` remote::
85+
86+
$ git config --local branch.main.remote upstream
87+
88+
8. Since one should never attempt to push to ``upstream``, configure
89+
``git`` to push always to ``origin``::
90+
91+
$ git remote set-url --push upstream git@github.com:<your-username>/cpython.git
92+
93+
9. Verify that your setup is correct::
8594

8695
$ git remote -v
8796
origin git@github.com:<your-username>/cpython.git (fetch)
8897
origin git@github.com:<your-username>/cpython.git (push)
89-
upstream git@github.com:python/cpython.git (fetch)
90-
upstream git@github.com:python/cpython.git (push)
98+
upstream https://github.com/python/cpython (fetch)
99+
upstream git@github.com:<your-username>/cpython.git (push)
100+
$ git config branch.main.remote
101+
upstream
91102

92103
If you did everything correctly, you should now have a copy of the code
93104
in the ``cpython`` directory and two remotes that refer to your own GitHub fork

0 commit comments

Comments
 (0)