<div dir="ltr"><div><div> cherry-pick will even grab the top commit of a branch if you give the branch name (presuming the fix is a single commit). For example:<br><br></div><div><span style="font-family:monospace,monospace">git checkout -b bug-fix-1.24 upstream/1.24</span> <span style="font-family:monospace,monospace"># create a branch for the fix in 1.24</span><br></div><span style="font-family:monospace,monospace">git cherry-pick bug-fix-master-branch</span> <span style="font-family:monospace,monospace"> # pull the fix across</span><br><br></div><div>There are various ways of grabbing multiple revisions too.<br><br></div>And of course, as per Ian's recent email you should be targeting fixes to the lowest affected version and working forwards. So really in your example the fix should be made for 1.24 and the cherry picked onto a branch made from master.<br><br><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 May 2015 at 13:15, Tim Penhey <span dir="ltr"><<a href="mailto:tim.penhey@canonical.com" target="_blank">tim.penhey@canonical.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">git cherry-pick does this as a git command.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 05/05/15 13:03, Jesse Meek wrote:<br>
> Hi All,<br>
><br>
> tl;dr `git diff --no-prefix master > diff.patch; patch -p0 < diff.patch`<br>
> is useful for landing bug fixes in different versions of juju.<br>
><br>
> As a lot of us are currently bug hunting and needing to land fixes in<br>
> multiple versions of Juju, I thought I'd share my process of doing that<br>
> (maybe it's helpful?):<br>
><br>
> So say you've branched master, let's call it "bug-fix-master-branch",<br>
> it's got your fix but you need to land it in 1.24. So branch 1.24, let's<br>
> call it bug-fix-124, and do the following:<br>
><br>
> # generate a diff of your changes that can be used with patch<br>
> (--no-prefix master is the magic flag that generates the right format)<br>
> (bug-fix-master-branch) $ git diff --no-prefix master > diff.patch<br>
><br>
> # don't add or commit, checkout the other branch<br>
> (bug-fix-master-branch) $ git checkout bug-fix-124<br>
><br>
> # diff.patch is still there, unstaged. So use it to add the patch<br>
> (bug-fix-124) $ patch -p0 < diff.patch<br>
><br>
> # do a sanity check<br>
> (bug-fix-124) $ git diff<br>
><br>
> # remove the patch file<br>
> (bug-fix-124) $ rm diff.patch<br>
><br>
> You've now got a bug-fix branch eligible for automatic merging targeting<br>
> 1.24.<br>
><br>
> Cheers,<br>
> Jess<br>
><br>
<br>
<br>
--<br>
Juju-dev mailing list<br>
<a href="mailto:Juju-dev@lists.ubuntu.com">Juju-dev@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju-dev" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju-dev</a><br>
</div></div></blockquote></div><br></div>