You can checkout the sub-branch, delete master branch, checkout a copy of your sub-branch and name it master.
git checkout sub-branch
git branch -D master
git checkout -b master
Question
I've seen this answer, but I'm unsure of what the answerer meant by using git branch -f ..
in order to complete the task.
I have three branches, my master
branch has a bunch of files that I don't want sticking around, which I know they will if I use merge. I somewhat understand deleting a branch, but can I really do that to the master
branch?
I know there is a probably simple solution to the problem, but could someone explain what each git command is doing? It would help a fair bit.
Question: How can I merge
my sub-branch
into the master while only keeping the files from the sub-branch
and none from the master
whilst keeping my sub-branch
?
Solution
You can checkout the sub-branch, delete master branch, checkout a copy of your sub-branch and name it master.
git checkout sub-branch
git branch -D master
git checkout -b master