I work a lot with GIT, both professionally and privately. Much of the work goes into maintaining different branches of code. When you want to port bug fixes you can use the cherry-pick mechanism to pick commits from, e.g., your master branch to an older branch.
However, developers do not always leave commits neatly portable and sometimes also mixes in other minor fixes and changes. So simply cherry-picking the complete commit is sometimes not possible.
Usually developers sigh and simply manually port patches by using an editor or diff/patch tools. This page exists to ease this task.
Take a look at these two web pages:
From a terminal
git cherry-pick -n <commit> # get your patch, but don't commit (-n = --no-commit) git reset # unstage the changes from the cherry-picked commit git add -p # make all your choices (add the changes you do want) git commit # make the commit!
With Magit you can cherry-pick an entire commit as follows:
In Emacs you can select just part of a commit using the following commands (from a ‘M-x magit-status’ buffer):