This is the state of my local repo. I was at AAAAA and made commit CCCCC. I did a git pull
and it pulled the commits and did an auto(ish) merge of BBBBB into CCCCC and made DDDDD. I don’t want that, so I killed DDDDD with a git reset.
$ git tree --all
CCCCC (HEAD, main) foobar issue 666
| * BBBBB (tag: fubar, origin/main, origin/HEAD) fubar issue #69
|/
* AAAAA foo
Instead of a merge, I want to move CCCCC onto BBBBB. How do I rebase this? Do I need to do a switch or checkout to BBBBB first?
* CCCCC (HEAD, main) foobar issue 666
* BBBBB (tag: fubar, origin/main, origin/HEAD) fubar issue #69
* AAAAA foo
Rebase is correct:
git fetch
git switch main
git rebase origin/main
You could probably just say git pull --rebase
instead, but I'm not one to take chances.