Have following branches structure:
master / \ BranchA BranchB
But it should be:
master / BranchA / BranchB
Could anyone advice how to re-hang BranchB as child of BranchA?
We can create a new branch with parent master branch and use git cherry-pick command to move each commit from one branch to another. This solution is OK, when you don't have many commits, because for each commit you need to do git cherry-pick .
Run the command git parent . That's it!
What happens? nothing. If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit.
You want to use rebase. With BranchB checked-out, do
git rebase BranchA
git checkout branchB; git rebase branchA;
will do this for you. bear in mind if this has been pushed somewhere else, you'll screw up the history.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With