{"id":603,"date":"2009-07-08T22:03:21","date_gmt":"2009-07-09T06:03:21","guid":{"rendered":"http:\/\/www.codebelay.com\/blog\/?p=603"},"modified":"2010-07-29T08:35:07","modified_gmt":"2010-07-29T16:35:07","slug":"git-how-to-cherry-pick-commits-and-package-them-under-a-tag","status":"publish","type":"post","link":"https:\/\/www.codebelay.com\/blog\/2009\/07\/08\/git-how-to-cherry-pick-commits-and-package-them-under-a-tag\/","title":{"rendered":"Git: How to Cherry Pick Commits and Package them Under a Tag"},"content":{"rendered":"<p>I&#8217;ve pretty much come to rely on git to pull me out of any bad jams in the chaotic environment I work in.<\/p>\n<p>One thing I&#8217;ve had to learn to do is cherry pick commits and package them under a tag in git.<\/p>\n<p>Here&#8217;s how to do it if you were working with my newLISP project called Sitebeagle:<\/p>\n<p>fork sitebeagle on <a href=\"http:\/\/github.com\/barce\/sitebeagle\/tree\/master\" target=\"_blank\">this page<\/a><\/p>\n<p>cd sitebeagle<\/p>\n<p>git fetch &#8211;tags<\/p>\n<p>git checkout 8f5bb33a771f7811d21b8c96cec67c28818de076<\/p>\n<p>git checkout -b sample_cherry_pick<\/p>\n<p>git cherry-pick 22aab7<\/p>\n<p>git cherry-pick b1334775<\/p>\n<p>git diff sample_cherry_pick..master<\/p>\n<p>git tag leaving_out_one_commit<\/p>\n<p>git push origin &#8211;tags<\/p>\n<p>At this point, you should have a tagged branch that doesn&#8217;t have the commit with the change to the &#8220;2nd file.&#8221; The diff should look exactly like this:<\/p>\n<p>diff &#8211;git a\/test.lsp b\/test.lsp<br \/>\nindex 9cf1667..158b625 100755<br \/>\n&#8212; a\/test.lsp<br \/>\n+++ b\/test.lsp<br \/>\n@@ -1,6 +1,7 @@<br \/>\n #!\/usr\/bin\/newlisp<\/p>\n<p> ; test tag test_a<br \/>\n+; cherry pick test 2<\/p>\n<p> (load &#8220;sitebeagle.lsp&#8221;)<br \/>\n (load &#8220;twitter.lsp&#8221;);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve pretty much come to rely on git to pull me out of any bad jams in the chaotic environment I work in. One thing I&#8217;ve had to learn to do is cherry pick commits and package them under a tag in git. Here&#8217;s how to do it if you were working with my newLISP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[170,206,4],"tags":[],"class_list":["post-603","post","type-post","status-publish","format-standard","hentry","category-command-line","category-git","category-how-to"],"_links":{"self":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/comments?post=603"}],"version-history":[{"count":0,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/603\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/media?parent=603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/categories?post=603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/tags?post=603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}