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

Time:11-11

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?

CodePudding user response:

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
  • Related