Skip to content

Commit 271fc3e

Browse files
authored
Add powershell example for 'git pr' alias (#1666)
1 parent d8483e5 commit 271fc3e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

getting-started/git-boot-camp.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,19 @@ Or set up a Git alias:
462462
463463
git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}" -'
464464
465-
.. tab:: Windows
465+
.. tab:: Windows cmd
466466

467467
.. code-block:: dosbatch
468468
469469
git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git switch pr_${1}' -"
470470
471+
.. tab:: Windows Powershell
472+
473+
.. code-block:: shell
474+
475+
git config --global alias.pr '!f() { git fetch upstream pull/$1/head:pr_$1 && git checkout pr_$1; }; f'
476+
477+
471478
The alias only needs to be done once. After the alias is set up, you can get a
472479
local copy of a pull request as follows::
473480

0 commit comments

Comments
 (0)