git rebase to create new branch and leave original where it is

git

Solution

If you are on the branch you want to keep, you can just create a new branch from current HEAD

git fetch
git branch backup_of_feature_ABZ
git rebase -i origin/master # if you are rebasing onto master
# then you can just squash or pick the change you want and you keep your "backup branch"
# Which makes good sense since it is backup and you did deliver the squashed commit. 

I hope i understood your problem correctly

Problem

I have a situation in which I have to maintain two branches over an extended period of time, and 'merge' is not attractive, since only selective changes should be carried back and forth. So I've learned to use cherry-pick. However, another alternative occured to me, but I fear that the rebase command lacks the necessary option. git rebase makes a set of new commits and then move a branch label to point to the last one. What I think I want here is simple: I want to leave the old branch label alone, and create a brand new branch label. My hypothesized workflow is to use this mechanism to create a single, squashed, commit, for cherry-picking, without rewriting history as seen by others. An approximation that occurred to me was to make a clone, rebase -i in the clone, rename the branch, and push the results back. Is there a way to do this directly with git rebase that I'm missing?

Original source