Create branch from another branch

Asked

Viewed 190 times

0

I don’t know if the title makes clear what I want to do but here’s the thing, I have the develop(root) and the develop2.0 (system overhaul). I would like to know how to create a branch that when finished, merge with develop2.0 instead of developing it.

  • 6

    git checkout -b meunovobranch develop2.0?

1 answer

0


I think what you want is to work with Feature branch - that’s a workflow concept in Git.

Basically, from the "root" branch of its development, in this case the develop2.0, you create branches for each functionality you develop, and when you finish you merge the Feature branch into the develop2.0.

The flow would be as follows:

  1. make sure you’re on the branch develop2.0
git status

1.1. if not, go to branch develop2.0

git checkout develop2.0
  1. from the branch develop2.0 start Feature branch to work on the feature, let’s call v2.0-F1 for example:
git checkout -b v2.0-f1
  1. work on the newly created branch v2.0-f1 to finalize the changes and be ready to merge into develop2.0

3.1 When you’re done and ready to merge the new changes, go back to branch develop2.0

git checkout develop2.0

3.2 being in the branch develop2.0 merge the changes from v2.0-f1

git merge v2.0-f1
  1. Re-flow to the next Feature

I hope this stream helps you, I use it with team of 2 or more developers and works well.

  • that’s right, dear thank you worked really well, and even this way I can even remove the branch after the merge if I no longer need to use it, vlw helped a lot

  • That’s right, the merge removes the Feature-branch. I take advantage and ask you to mark the answer as accepted, so others can identify as a real solution to the problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.