git pull --rebase
git push origin my_branch
Rebasing a branch in Git may involve rewriting the history of that branch, assuming that the bases of the two branches were different. From what you told us, it seems that you rebased on a different branch. Most likely, in your case, your
my_branch was rewritten, which means you cannot simply push to the remote.
To get around this, you can force push your branch via:
git push --force origin my_branch
However, you might not want to do this if the rebase on a different branch were unintentional.
Instead, try rebasing this way:
git pull --rebase origin my_branch # resolve merge conflicts, if any git push origin my_branch
Force pushing a public shared branch is usually a bad idea, because it causes problems for everyone who shares that branch. If your current workflow involves doing this, you might want to reconsider.