Last active
July 11, 2022 10:08
-
-
Save jussi-kalliokoski/4381703 to your computer and use it in GitHub Desktop.
Cherry-picks commits from master that have changes to specified files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $!/usr/bin/env sh | |
| branch=`git symbolic-ref --short HEAD` | |
| git checkout master | |
| commits=`git log --pretty="%H" --reverse -- $*` | |
| git checkout $branch | |
| for commit in $commits; do | |
| git cherry-pick $commit | |
| done |
should not first line have #!/usr/bin/env instead of $!/usr/bin/env, i.e. hash instead of the dollar?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After some thought about this, Do you have any opposition to creating a new repo and doing a sparse-checkout ?
This way you could just checkout the files you want to a new repo. like so.
check this out
now you can create quite a complex include easily.
if you want to run this in an existing repo just use
git read-tree -mu HEADagain to update the working tree.What are your thought is this a more efficient way for you? I would LOVE to hear your thoughts.