GIT - Isolate new branch master feature in a new branch and reset branch master.

3

I created a new feature in the master branch and would like to isolate it in a new branch.

Also, after creating the new branch, I would like to reset my master branch branch to the remote master branch.

I created this new local branch, which ends up being a copy of the local branch master (already including my feature), now I do not quite understand how to reset only my local master to be exactly the same as the master master. >

I need to do this to be able to commmit and push the master without changing the production application with this new feature, which is not yet complete.

I hope it was clear that my goal is to only reset the master and not the rest.

Thank you.

    
asked by anonymous 20.10.2016 / 15:52

1 answer

5

If you have not done any commit in your branch master , you can do git checkout -b feature so that a new branch is created with the changes made.

With this, your branch master will conform to the branch remote as all the changes made will belong to the branch feature .

For your understanding, see the simulation in learngitbranching with the following commands:

  • git branch feature
  • git checkout feature
  • git commit
  • Another example showing a commit in the branch master after the feature v

        
    20.10.2016 / 16:27