[MacPorts] WorkingWithGit modified

MacPorts noreply at macports.org
Sat Aug 20 14:29:44 PDT 2016


Page "WorkingWithGit" was changed by cal at macports.org
Diff URL: <https://trac.macports.org/wiki/WorkingWithGit?action=diff&version=14>
Revision 14
Comment: Document cherry-picking.
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: WorkingWithGit
=========================================================================
--- WorkingWithGit (version: 13)
+++ WorkingWithGit (version: 14)
@@ -83,6 +83,25 @@
 }}}
 
 Note that the push will fail if the remote repository has new changes. Contrary to Subversion, it does not matter whether your changes conflict with the remote ones. If this happens, you must update your local working copy as described in the [#updating section on fetch the latest changes] and re-try the push.
+
+=== Merge a single change from master into a release branch ===
+The equivalent to Subversion's `svn merge -c <revision> .` is `git cherry-pick`. Use `git cherry-pick` to merge a single change from master into a release branch. To do this, look up the commit ID of the commit you want to pick:
+{{{
+git log
+# copy the commit ID
+}}}
+Switch to the target branch of the cherry pick:
+{{{
+git checkout release_2_3
+}}}
+Cherry-pick the commit. It is good practice to pass `-x` to `git cherry-pick`, which will automatically add a "Cherry picked from commit <commmitID>" line to the commit message of your cherry pick. You will have the option to modify the commit message, e.g. to describe why the backport was necessary.
+{{{
+git cherry-pick -x <commitID>
+}}}
+Finally, push the new commit using
+{{{
+git push [origin <branchname>]
+}}}
 
 
 == Common `git` tasks & notes about MacPorts' Subversion export ==
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/WorkingWithGit>
MacPorts <https://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'WorkingWithGit' page.
If it was not you, please report to .


More information about the macports-changes mailing list