In plain words
Merging joins two branches with a merge commit and keeps history as it happened, while rebasing replays your commits on top of the latest main, giving a straight history but new commit ids.
Where you see it
Your Harbor branch is 30 commits behind main. git merge origin/main adds one merge commit to your branch, while git rebase origin/main moves your commits so they start from today's main. GitHub's merge button offers a similar choice: Create a merge commit, Squash and merge, or Rebase and merge.
What goes wrong
- Rebasing a branch others are using
Rebase rewrites commit ids. A teammate who pulled the old ones now has a diverged branch, and your force push can wipe out commits they pushed. Rebase only branches you alone work on.
- Pushing with plain --force
Plain --force overwrites the remote branch whatever is on it. Use --force-with-lease, which stops if the remote has commits you haven't seen.
git push --force - Resolving the same conflict again and again
A rebase replays each commit in turn, so one conflict can return at several of them. On a long branch a single merge may be less work, and turning on git rerere lets git reuse resolutions you've already made.
What to tell your agent
Quick check
Sign in to earn +10 XP for itYou and a teammate both push to feat/team-billing. You rebase it onto main and force-push. What happens to your teammate?