I have a source repo with several folders and a number of commits across those folders. I am looking to cherry-pick some of the commits that created specific files and sub-folders in the source repo and move them into the root folder of a destination repo.
E.g.
source_repo/
|--linux/
|--scripts_folder/
| |--script1.sh
| |--script2.sh
|--notes.bash
destination_repo/
|--Readme.md
I am trying to end up with a structure like this:
destination_repo/
|--scripts_folder/
| |--script1.sh
| |--script2.sh
|--notes.bash
|--Readme.md
I have tried the following, but it pulls the linux
folder in as well.
cd destination_repo
git remote add source https://github.com/user/source_repo.git
git remote update
git cherry-pick <sha-start>^..<sha-end>
This should be possible by providing the subtree strategy-option:
This option is a more advanced form of
subtree
strategy, where the strategy makes a guess on how two trees must be shifted to match with each other when merging. Instead, the specified path is prefixed (or stripped from the beginning) to make the shape of two trees to match.
cd destination_repo
git remote add source https://github.com/user/source_repo.git
git remote update
git cherry-pick -Xsubtree=linux <sha-start>^..<sha-end>