[Howto] Git Cherry Pick From Pull Requests
-
This short sketch outlines the process to try pull requests (PR) before they are merged into the master. I am using RetroPie-Setup and PR 3126 as sample but it is not limited to this repo/PR. Works the same on any git(hub) repo.
On your RetroPie as user
pi
:-
Change to folder:
cd ~/RetroPie-Setup
-
Update your local repo to remote
origin/master
: Rungit pull
-
Create a branch with all changes of a pull request (replace 3126 with your specific PR you want to try) (ahead and behind
origin/master
):git fetch origin pull/3126/head:PR_3126
-
List commits where PR is ahead of current master:
git log HEAD..PR_3126
(Should list one commit:e5665ae90a0d1bacd3f904194bb263a93cd2d19d
) -
Create a new branch to hold the "ahead commits":
git checkout -b lrvice_moretargets_cherries
-
Put the cherry (or cherries if more than one commit) in your basket, errm. branch:
git cherry-pick e5665ae
(first seven characters of above commit are sufficient) -
Side note: Now you may understand why it is useful to have a PR squished to one commit. ;)
-
Optional: Check if it worked:
git diff origin/master
output should start like this:diff --git a/scriptmodules/libretrocores/lr-vice.sh b/scriptmodules/libretrocores/lr-vice.sh index 53f7cb8d..553fdeb6 100644 --- a/scriptmodules/libretrocores/lr-vice.sh +++ b/scriptmodules/libretrocores/lr-vice.sh @@ -10,37 +10,57 @@ # rp_module_id="lr-vice" -rp_module_desc="C64 emulator - port of VICE for libretro" -rp_module_help="ROM Extensions: .cmd .crt .d64 .d71 .d80 .d81 .g64 .m3u .prg .t64 .tap .x64 .zip .vsf\n\nCopy your Commodore 64 games to $romdir/c64" +rp_module_desc="C64 / C128 / PET / Plus4 / VIC20 emulator - port of VICE for libretro" +rp_module_help="ROM Extensions: .cmd .crt .d64 .d71 .d80 .d81 .g64 .m3u .prg .t64 .tap .x64 .zip .vsf\n\nCopy your games to $romdir/c64" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/vice-libretro/master/vice/COPYING" rp_module_repo="git https://github.com/libretro/vice-libretro.git master" rp_module_s[...]
-
Use
retropie_setup.sh
/retropie_packages.sh
scripts as usual -
Smile (:
Final notes
- Reverting as easy as:
git checkout master
, that's all. - If you wish, you can still return to the version of the PR with
git checkout lrvice_moretargets_cherries
. - If you forgot the branch name or uncertain on which branch you are:
git branch -l
is your friend. - If you want to get rid of your cherrypicked branch do
git branch -D lrvice_moretargets_cherries
.
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.