I want to keep the blue branch's commits and neglect the pink branches, so in result I would have single branch and it must be the main branch.
the blue branch is 'rework' while the pink branches are (top one is 'master', bottom one is 'main') both of them are 'not included in head' Idk what does it mean.
I think I have messed up things when I make branch 'rework', I think I should have just undo the commits back to 'initial' commit instead of making a branch.
I don't have much exp in merging, I'm afraid that merging will include changes from pink branches, and I DON'T WANT ANY CHANGE FROM PINK BRANCHES TO BE INCLUDED.
CodePudding user response:
Simply (force) delete the other branches, then rename your branch:
git branch -D master main
git checkout rework
git branch -m main
NB. commits of your "pink" branches will be unreachable and are basically lost. You will not have access to them anymore via normal means.
This will only affect your local repository. If the branches already exist in a remote repository, be aware that you have rewritten your repository's history. This could be bad, if it were shared between several developers. If that's okay, then you can force-push your local branch state to the remote repository.