A rebase refuses to start while you have uncommitted changes. The stash, rebase, pop routine works, but it is three commands and easy to forget the last one. --autostash does all three for you.
Git creates a temporary stash before the rebase and applies it when the rebase is done:
git rebase --autostash origin/main
Without the flag you get this instead:
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.
With the flag, Git prints Created autostash at the start and Applied autostash. at the end, and your edits are back in the working tree. If you want this every time, set it once. --no-autostash switches it off for a single run.
git config --global rebase.autoStash true
The docs warn that the final stash application after a successful rebase might result in non-trivial conflicts. That happens when your uncommitted edit touches a line the rebased commits changed. Git then says Applying autostash resulted in conflicts and tells you that your changes are safe in the stash. The rebase itself is finished at that point, the stash entry stays in git stash list, and you resolve the conflict by hand. Run git stash drop once you are happy with the result.
For more than a few small edits I would still commit a work-in-progress commit first. A commit is easier to get back than a stash entry you forgot about.
Further reading: git-rebase documentation