Simone Nigro
Simone Nigro

Reputation: 4887

How merge tag into branch?

I'm building a continous integration pipeline based on a git repository.

I have 3 branch:

Any time a branch is updated, a pipeline update my website, eg:

Everytime I release a new version, I update the master branch and tag the commit whit the version number:

# procedure for deploy on dev
git add -A
git commit -m "1.0.0"
git tag 1.0.0
git push --set-upstream origin master --tags

This works...

When i want to put the 1.0.0 version into test environment this is the procedure

# procedure for deploy on test
git fetch --tags origin
git checkout -B test
git merge 1.0.0
git push --set-upstream origin test

This works... but this procedure don't work on rollback, if test branch is on version 2.0.0 the snippet don't rollback the branch on version 1.0.0. If i made a:

git show-branch *test

the output show:

! [refs/remotes/origin/test] 2.0.0
  * [test] 2.0.0
 --
 +* [refs/remotes/origin/test] 2.0.0

Upvotes: 0

Views: 6467

Answers (1)

Giovanni Fiorentino
Giovanni Fiorentino

Reputation: 91

you can try to reset the branch and after push it

git reset --hard <tagname>
git push -f -u origin branch

Upvotes: 3

Related Questions