Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer upstream for main #943

Merged
merged 6 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions getting-started/git-boot-camp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,29 @@ You will only need to do this once.
Cloning a Forked CPython Repository
-----------------------------------

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

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

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

cd cpython
git remote add upstream git@github.com:python/cpython.git
git remote add upstream https://github.com/python/cpython

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

Configure the Remotes
---------------------

Configure ``git`` to pull ``main`` from the ``upstream`` remote::

git config --local branch.main.remote upstream

Since one should never attempt to push to ``upstream``, configure
``git`` to push always to ``origin``::

git remote set-url --push upstream git@github.com:<username>/cpython.git

Listing the Remote Repositories
-------------------------------

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

origin git@github.com:<username>/cpython.git (fetch)
origin git@github.com:<username>/cpython.git (push)
upstream git@github.com:python/cpython.git (fetch)
upstream git@github.com:python/cpython.git (push)
upstream https://github.com/python/cpython (fetch)
upstream git@github.com:<username>/cpython.git (push)

To verify the upstream for ``main``::

git config branch.main.remote

It should emit ``upstream``, indicating to track/pull changes for ``main`` from the
``upstream`` remote.


.. _set-up-name-email:
Expand Down
21 changes: 16 additions & 5 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The CPython repo is hosted on GitHub. To get a copy of the source code you shoul
:ref:`fork the Python repository on GitHub <fork-cpython>`, :ref:`create a local
clone of your personal fork, and configure the remotes <clone-your-fork>`.

You will only need to execute these steps once:
You will only need to execute these steps once per machine:

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

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

$ cd cpython
$ git remote add upstream git@github.com:python/cpython.git
$ git remote add upstream https://github.com/python/cpython

7. Verify that your setup is correct::
7. Configure ``git`` to pull ``main`` from the ``upstream`` remote::

$ git config --local branch.main.remote upstream

8. Since one should never attempt to push to ``upstream``, configure
``git`` to push always to ``origin``::

$ git remote set-url --push upstream git@github.com:<your-username>/cpython.git

9. Verify that your setup is correct::

$ git remote -v
origin git@github.com:<your-username>/cpython.git (fetch)
origin git@github.com:<your-username>/cpython.git (push)
upstream git@github.com:python/cpython.git (fetch)
upstream git@github.com:python/cpython.git (push)
upstream https://github.com/python/cpython (fetch)
upstream git@github.com:<your-username>/cpython.git (push)
$ git config branch.main.remote
upstream
jaraco marked this conversation as resolved.
Show resolved Hide resolved

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