✅ How to "rename" Git remote branch?
On <remote> I have a
Product/develop
branch which I want renamed to Product/x_develop
. Then I want to take the Product/y_develop
, also on <remote> and rename to Product/develop
. Both branches will continue to be in used. Product/develop will host the future development while 'Product/x_develop' will only be used for service packs.
x/develop
has service pack branches x.y, x.z, etc.
What's the best way to go about this without breaking anything?8 Replies
Btw this is a "breaking" change so you should probably tell other people about this if you're not the only one working on the repo
I don't think it's possible to do this without "breaking" anything
I apologize, I've messed up the description in a fundamental way (perhaps). I've updated the name of the first branch from 'x/Develop' to 'Product/develop'. The takeaway is that I want the new branch to take the name of the old branch.
And the old branch put away for just service packs.
I don't want to lose data. I do expect this will require notifications and reconfiguraitons for the developers affected, but I don't want to get into some sort of irrecoverable data situation.
I think you can just make a new branch and keep the old and put up a note you're going to change the branch name and give time for other people to prepare their PR's
And I want the service packs that were branched off what was 'Product/develop' now to point to 'Product /x_develop', the new name for the old branch.
Are the old service pack branches going to 'just work' with respect to the new 'Product/x_develop' branch?
But I do not want to rename the service pack branches. Those names are set. I just want to preserve somehow the parenting relationship
But not sure if I need to redo it manually, or it will just track the commit nodes, and essentially just work despite the renaming.
I think they should preserve "the relationship" with the service pack 🤔
So in theory, one would be able to take a service pack branch, let's say SP (originally branched off 'Product/develop') and merge it back into 'Product/x_develop'
Branches are pointers to commits, so it's about what commits are in which path on the graph, if you've squashed a bunch of commits to long lived branches you're going to have a bad time, with lots of potential conflicts, some of it depends on your practices in git
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.