Bug: Checking out others pull request (via git alias) in git bootcamp is resulting in an error
Describe the bug
tested OS-Windows
Screenshots
Additional context
No response
The relevant section for reference: https://devguide.python.org/getting-started/git-boot-camp/#checking-out-others-pull-requests.
Note that the git config command in the screenshot isn't quite the same as the one in the devguide. The devguide command uses single quotes (') around the alias string while the command in the screenshot uses double quotes ("). That distinction is important, since using single vs double quotes changes how variable expansions like ${1} work. See for example https://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash for more details. The command should work if you copy-paste the git config command from the devguide exactly as written.
@brianschubert Thank you for looking into this :) I actually did copy paste it. I don't see the difference b/w the screenshot above and this (image directly from the dev guide):
and here is the copied text:
git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}' -"
I did verify it again by copy-pasting the command still the same as the initial screenshot
seems like you are looking at Unix/MacOS command which is exactly as described by you:
git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -'
Ah, I see. Thanks for clarifying. What shell are you using? From the screenshot, it looks like you're using git bash or another Unix-like environment, in which case you'd need to use the Unix command.
Using PowerShell in windows
Maybe I need to stop decorating the terminal (it definitely looks like Unix/bash) 😅
Interesting! I don't have experience with PowerShell, so I have no idea what the expected quoting behavior is. It's possible that the Windows command in the devguide was written with cmd.exe in mind, not PowerShell. Does reversing the quotes like in the Unix command work on PowerShell?
I did use the Unix/MacOS command in the terminal and here is the screenshot (not working)
and the command correctly works in the Command Prompt (cmd.exe in windows)