RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [Howto] Git Cherry Pick From Pull Requests

    Scheduled Pinned Locked Moved Ideas and Development
    gitpull requestcherry pickhowto
    1 Posts 1 Posters 864 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LolonoisL
      Lolonois
      last edited by

      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:

      1. Change to folder: cd ~/RetroPie-Setup

      2. Update your local repo to remote origin/master: Run git pull

      3. 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

      4. List commits where PR is ahead of current master: git log HEAD..PR_3126 (Should list one commit: e5665ae90a0d1bacd3f904194bb263a93cd2d19d)

      5. Create a new branch to hold the "ahead commits": git checkout -b lrvice_moretargets_cherries

      6. 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)

      7. Side note: Now you may understand why it is useful to have a PR squished to one commit. ;)

      8. 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[...]
        
      9. Use retropie_setup.sh / retropie_packages.sh scripts as usual

      10. 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.
      1 Reply Last reply Reply Quote 3
      • First post
        Last post

      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.