What is a rebase?
Replaying your commits on top of another branch: one straight line, made of new commits.
A rebase is the other answer to two branches that have diverged. Instead of joining them with a merge commit, Git takes the commits that are only on your branch and replays them, one at a time, on top of the other branch. The result reads as if you had started your work after theirs: one straight line, no join.
The word to hold on to is new. A rebase does not move your commits. It
makes new ones with the same changes and different names, and points your
branch at those. Anyone who already had the old commits, a remote or a
colleague, still has them, and their copy of the branch and yours now
disagree about what the branch is. feature has D and E, and has been pushed, so origin/feature is at E as well. main has F. C is the last commit they share. Rebase feature onto main. D is replayed on top of F as D′, E on top of that as E′, and feature moves to E′. The remote still has D and E. A force push replaces the remote's feature with yours. Now nothing reaches D and E: the reflog remembers them for a while, then they go. Merging feature into main is now a fast-forward: main moves to E′, and the history is one straight line. The branch has done its job, and its names, local and remote, can go.
What it costs, and when it is worth it
The rule of thumb is short: rebase work that only you have, merge work that other people have. A branch nobody else has fetched can be rebased freely, and rebasing it onto the branch it will land on means the merge that follows is a fast-forward, or a merge commit with nothing tangled inside it. A branch other people have is a different matter: after a rebase every copy but yours points at commits your branch no longer contains, and pushing it needs a force push, with lease, so that it refuses if someone has pushed in the meantime.
A rebase replays commits one at a time, so it can stop more than once. Each commit is a separate chance to conflict, resolved the same way as in a merge, after which the rebase carries on. Interactive rebase is the same operation with a pause at every commit, where one can be edited, reordered, dropped or squashed into its neighbour.
On the command line
git switch feature
git rebase main # replay feature's commits on top of main
git push --force-with-lease # replace the remote's copy, if you must
git rebase -i main # the interactive form
Git’s own reference: git-rebase. The Pro Git book has the same diagram and the same warning.
In Innesta
Rebasing is where Innesta runs one, and what it does about signing and conflicts along the way; force pushing is the push that follows when the branch was already on the remote, and tidying up a branch before a review is the everyday use. The interactive form is one of the things Innesta leaves to the command line.
The Playground is a repository made for trying a rebase on; it has no remote, so the push is not part of the exercise.