MHN
Add a comment on Hacker News →
1 of 307 comments
  1. "under the hood git rebase main is merging the current branch into main (it’s like git checkout main; git merge current_branch"

    This is wrong. 'git rebase main' doesn't affect main at all! If you are on main and check out a new branch, then add commit-one, then switch back to main and add commit-two, then switch back to the new branch and 'git rebase main', your new branch will have commit-one and commit-two, and main will still only have commit-two.

    it's much more like simply 'git merge main' with some extra magic to avoid a separate merge commit.