Comment by MathiasPius
5 days ago
You can pull another branch without switching first:
git switch my-test-branch
...
git pull origin main:main
git rebase main
5 days ago
You can pull another branch without switching first:
git switch my-test-branch
...
git pull origin main:main
git rebase main
You can also rebase directly on the remote branch
> git rebase origin/main
When 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:
or
Nice. That'll make things a bit smoother. Changing branches often trips me up when I would later `git switch -`.
Likewise with the other way around, just switch pull with push.
I have always done `git pull origin main -r`