I assume your question stems from the common workflow of having one central git repository instead of private forks. On that remote repository all the branches can be pushed to by all the developers.
And just because they can, each developer may feel empowered to just push and merge whatever they want. With such a workflow, git rebase can indeed become dangerous as developers might delete commits due force pushing due to accidentally deleting commits that already have been pushed.
If you have this cowboy git workflow going on, then it may be sensible to advise developers to use --force-with-lease instead of just --force.
I would argue that collaboration and sharing feature branches going out the window is a good thing.
In my team's main remote git repository (the source of truth) I have master branch protected against rebases.
I recommend these rules:
- always derive a feature branch from master, no exceptions
- again: never derive a feature branch of another feature branch
- if you depend on another feature currently being developed by another dev, wait for them to merge those changes into the master
rebase your feature branch against master often (to include your dependencies, or to just keep the master up to date) as it helps to resolve merge conflicts as they happen - optional: squash your commits to one, if you use a git web-frontend (github, bitbucket, ...) they provide the feature to merge squash a Pull Request, you may want to use that as well
The developer creating the branch owns the branch. They can do whatever they want: deleting, rebasing, tango merging, working with others in pair programming on this branch (others might still commit on their branch but only with the owner's explicit consent and knowledge).
The main branches, e.g. master or develop, are the public ones. They are holy. You don't change their history and you protect them from being deleted and their history from being overwritten. If you need to undo a feature on the main branch, you'll use revert.