I used the git subtree
command on an existing repository, in order to extract a subfolder into its own repository. Then, I pushed the extracted commits to its new repository, into the master-branch
.
However, I should have pushed it into the "feature/FT001"-branch
all along and wanted to change everything accordingly:
- renamed the branch:
git branch -m feature/FT001
- delete old branch and push new:
git push origin master feature/FT001
- reset the upstream branch:
git push origin -u feature/FT001
At this state, the master branch does not exist anymore locally and at origin.
I would like to add a new (and empty) master-branch
now. It should look like I have never worked on master
before (no commits). The history should look like there was a master
branch, I then created the feature-branch
and commited everything to the feature-branch
(and will eventually merge my feature-branch
into the master-branch
).
How can I do these last steps?