Forward master to to tag

Viewed 27
  • I commited to master
  • I created a tag for this commit using git tag -v v1.7 -m "foo"
  • I checked out a tag git checkout v1.7 (master is pointing to the same commit ID)
  • Then I created a commit
  • Then I tagged this commit using git tag -v v1.8 -m "bar"

How do I get master to be at the same commit ID as the tag v1.8

2 Answers

How do I get master to be at the same commit ID as the tag v1.8

If there were no new commits on master while you created v1.8, then you can switch to it and merge from v1.8 to get master fast-forwarded to v1.8:

git checkout master
git merge v1.8

I prefer to create a new branch from v1.8. Then create Pull request & merge the branch into master.

$ git checkout v1.8
$ git checkout -b branch1.8
$ git push origin HEAD      # push branch1.8 to remote

Create Pull request and merge it with master Or, you can directly merge branch1.8 into master like:

$ git checkout master
$ git pull origin branch1.8    # fetch + merge 'branch1.8' into 'master'

$ git push origin master       
Related