Search code examples
gitgitlabbranch

Create feature branch for files already pushed to master branch for pull request


I have a master branch with following structure

master (branch)
folderA
folderB
folderC

I want to shift folderC to a feature branch so I can create a merge request to master branch.

It should be like this

master (branch)
folderA
folderB
newFeatureBranch1 
folderC

I have pushed my code to an online repository what is the best way to do this?


Solution

  • From master:

    git rm --cached folderC
    git commit -m "Remove folderC"
    git push origin master
    

    then from the feature branch:

    git add folderC
    git commit -m "Add folderC"
    git push origin featurebranch