Skip to content

Instantly share code, notes, and snippets.

@nickfloyd
Created December 13, 2010 17:40
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save nickfloyd/739288 to your computer and use it in GitHub Desktop.
Save nickfloyd/739288 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]
ex.
git branch a release_a
git checkout a
git cherry-pick 899a25202dbf8bdb58fc73ae836f50660ec0b23b
git tag -d release_a
git tag release_a
git push origin :release_a
git push origin release_a
@robwithhair
Copy link

Very handy, thanks for publishing this.

@davilima6
Copy link

Ty!

@antenore
Copy link

Thanks a lot! Forked and adapted to my case. Ty! Ty!

@nic-hima
Copy link

came in quite handy for a 2 line commit. Starred!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment