How can I create a Git branch and merge it back to master with a different tag?

Issue

I have a repo in github
one branch called master.
it has 3 tags:

1.0.0
2.0.0
3.0.0

I’d like to take the code from master:2.0.0, modify it and push it back so the end result I’ll have one master branch with tags:

1.0.0
2.0.0
2.0.1 --> new code
3.0.0

so from my machine i do:

git clone <repo url>
git checkout tags/2.0.0
git checkout -b feature/fix
(now i modify the code)
git add .
git commit -m "Changed code"

I’m really not sure what to do from here. What am I missing?

Solution

I take it the goal is to splice 2.0.1 into the direct chain of master’s first-parents. After

git clone <repo url>
git checkout tags/2.0.0
git checkout -b feature/fix
(now i modify the code)
git add .
git commit -m "Changed code"

You would tag this commit as 2.0.1.

git tag -a 2.0.1

Then after tagging you would say

git rebase --onto 2.0.1 2.0.0 master

Answered By – matt

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published