Never rebase public branches, ie. ones that other people might have checked out. It will rewrite history and make them sad. Rebasing your own branches other people have no business checking out is perfectly fine.
Bonus points for never doing a (non fast-forward) merge of upstream branch into your branch (if you plan to merge your branch back into the upstream one later). If you do need to update your branch before it gets merged, rebase it instead.
What to do if your public branch needs to be updated from upstream? Create a fresh one off of upstream, merge your branch into it, and continue working on a new one.
Bonus points for never doing a (non fast-forward) merge of upstream branch into your branch (if you plan to merge your branch back into the upstream one later). If you do need to update your branch before it gets merged, rebase it instead.
What to do if your public branch needs to be updated from upstream? Create a fresh one off of upstream, merge your branch into it, and continue working on a new one.