You can pull another branch without switching first:
git switch my-test-branch
...
git pull origin main:main
git rebase main git switch my-test-branch
...
git pull origin main:main
git rebase main git fetch
git rebase origin/mainWhen is that command actually useful? When you want to rebase it is likely because your local and the upstream branch have diverged, so this would just result in weird conflicts, because origin/main is no longer an ancestor to main. Wouldn't you want to use something like:
git rebase $(git merge-base main origin/main) main --onto=origin/main
or git rebase origin/main@{1} main --onto=origin/main
?