Skip to content

Commit 4089dbf

Browse files
authored
Update Git alias command for pulling PR branches
1 parent 677a079 commit 4089dbf

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

getting-started/git-boot-camp.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,19 +453,26 @@ Both of these tools will configure a remote URL for the branch, so you can
453453
``git push`` if the pull request author checked "Allow edits from maintainers"
454454
when creating the pull request.
455455

456-
If you don't have GitHub CLI or hub installed, you can set up a git alias:
456+
If you don't have GitHub CLI or hub installed, you can run the following commands:
457+
458+
.. code-block:: shell
459+
460+
$ git fetch upstream pull/NNNNN/head:pr_NNNNN
461+
$ git switch pr_NNNNN
462+
463+
or set up a Git alias:
457464

458465
.. tab:: Unix/macOS
459466

460467
.. code-block:: shell
461468
462-
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -'
469+
$ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'
463470
464471
.. tab:: Windows
465472

466473
.. code-block:: dosbatch
467474
468-
git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}' -"
475+
git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}' -"
469476
470477
The alias only needs to be done once. After the alias is set up, you can get a
471478
local copy of a pull request as follows::

0 commit comments

Comments
 (0)