Skip to content

Instantly share code, notes, and snippets.

@antenore
Forked from nickfloyd/recipe: cherry-pick tags
Last active August 17, 2016 08:17
Show Gist options
  • Save antenore/ec661af8b4ff744c3d067600216a5768 to your computer and use it in GitHub Desktop.
Save antenore/ec661af8b4ff744c3d067600216a5768 to your computer and use it in GitHub Desktop.
To cherry pick from head and commit back into a tag
-from master in working branch
>> git branch [new branch] [tag]
>> git checkout [branch]
-pull commit out and add it to the commit at the top of the tag
>> git cherry-pick [commit] or git cherry-pick [firstcommit]^..[lastcommit] if you have a range
-resolve conflicts
-delete the local tag
>> git git tag -d [tag]
-add a new tag at the head of the old one
>> git tag [tag]
-delete the remote tag
>> git push origin :[tag]
-push new tag and commits
>> git push origin [tag]
Real life example:
git branch b_v1.2.0-rcgit.15 v1.2.0-rcgit.15
git checkout b_v1.2.0-rcgit.15
git cherry-pick b939ee66a1aedde5b108c403a3dc46f72e03430f
git tag -d v1.2.0-rcgit.15
git tag v1.2.0-rcgit.15
git push origin :v1.2.0-rcgit.15
git push origin v1.2.0-rcgit.15
git checkout next
git show
git show v1.2.0-rcgit.15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment