Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update bootcamp FAQ about "Checking out others' PRs" #1694

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

Open
ezio-melotti wants to merge 4 commits into python:main
base: main
Choose a base branch
Loading
from ezio-melotti:update-alias

Conversation

@ezio-melotti
Copy link
Member

@ezio-melotti ezio-melotti commented Nov 18, 2025
edited
Loading

I wanted to pull a PR branch and I was looking up "Checking out others' PRs", and the options were either to install gh, hub, or creating a Git alias.

Since I wanted a less permanent solution, I created this PR to show the commands individually before suggesting adding them as an alias. In addition I replaced checkout with the more modern switch, and capitalized "Git".

Another possible solution is to add the contributor's repo as a remote and fetch their branch from there, but I didn't want to add yet another solution. If people want to add it, we can create another PR.


📚 Documentation preview 📚: https://cpython-devguide--1694.org.readthedocs.build/

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And replace the other two git checkout on this page with git switch?

And also on getting-started/pull-request-lifecycle.rst and index.rst?

.. code-block:: shell
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -'
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'
git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'

Copy link
Member Author

@ezio-melotti ezio-melotti Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most command in the page have the $, even though I don't remember if there was a specific reason/convention, so I didn't remove it. We could remove most/all of them in a separate PR.

https://devguide.python.org/documentation/style-guide/#code-examples says to use prompts sparingly to differentiate input/output lines, even though it's talking mainly about Python >>>/.... We could remove most/all of them in a separate PR.

Also note that the shell highlight is for shell scripts, whereas the console highlight for shell sessions with prompts (see https://pygments.org/docs/lexers/#lexers-for-various-shells).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, console is useful when you have a prompt and output to show. Otherwise shell for plain commands.

Console:

$ ls | wc -l # good formatting for command + output 👍 
 158
ls | wc -l # bad formatting for command 👎 

Shell:

$ ls | wc -l # bad formatting for output 👎 
 158
ls | wc -l # good formatting for command 👍 

ezio-melotti reacted with thumbs up emoji
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
.. code-block:: shell
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -'
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'
Copy link
Member Author

@ezio-melotti ezio-melotti Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most command in the page have the $, even though I don't remember if there was a specific reason/convention, so I didn't remove it. We could remove most/all of them in a separate PR.

https://devguide.python.org/documentation/style-guide/#code-examples says to use prompts sparingly to differentiate input/output lines, even though it's talking mainly about Python >>>/.... We could remove most/all of them in a separate PR.

Also note that the shell highlight is for shell scripts, whereas the console highlight for shell sessions with prompts (see https://pygments.org/docs/lexers/#lexers-for-various-shells).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk approved these changes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /