Create branch afterwards, apply tags and use specific commit for both branches

79 views Asked by At

Currently I only have a master branch. Now I should create a new branch called MDM, which should reflect a certain version of a program.

Current planned branches with commits

To do this I would create the new branch from the commit from May 13:

git checkout -b MDM dba331
git tag -a MDM1.0.0 -m 'v. 1.0.0'

I also would tag it. Then I would do that for the second commit:

git checkout master
git checkout 694aef
git checkout MDM
git merge master
git tag -a MDM1.0.1 -m 'v. 1.0.1'
git checkout master
git checkout dbf2611

So I take an old version of the master and merge it into my MDM branch and tag it. Finally, I want to set the master to it's latest state.

I think that should work in this way. My main problem is the commit from June 15. I only want this commit in my MDM branch (this means excluding the commit from June 10). Should I use a patch for this? Or should I use git cherry-pick? The commit (June 15) can stay in the master branch, but the commit from June 10 should not be in the MDM branch.

In future I think I will need a new branch for every bug/feature so that merging between branches is much simpler.

1

There are 1 answers

0
Philippe On

Use cherrypick, it's simpler and it create and apply a patch behind the scene...