To set up a scene:
I am working on new feature and have branch X based on branch A. I have multiple commits in X. My coworker has done some changes which required force push to branch A. Now I want to be in a state where I have my coworkers branch A and my commits from branch X on top of it.
If I would now use git rebase on my coworkers newly-rewritten branch A, I would have a lot of conflicts from his history-rewriting.
To get in the state I want, I would usually just copy my branch X to backup Y, reset hard X to A and cherry pick my commits from Y to X again. (If I am not mistaken, I could do the same and instead of cherry pick use git rebase --onto).
tldr:
Is it possible to do this with one command, without the branch copies? What I basically want is
"reset this branch to remote and apply current last X commits on top of it"