Created
May 1, 2020 07:46
-
-
Save indraniel/6b90f24cda0b5d0c9495532f74a17459 to your computer and use it in GitHub Desktop.
technique to transfer commits from one git repository to another different git repository
This file contains 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
#!/bin/bash | |
# select the relevant commits i would like to take from source git repoA | |
mkdir -p patches | |
git format-patch -1 --stdout 8adb447ccbfd88bf57a571105f6af3b000f343c5 >patches/1.patch | |
git format-patch -1 --stdout 8f71637c2e407aa8d9e040b1f8168cd5bc9590a4 >patches/2.patch | |
git format-patch -1 --stdout 968ac4b5e74abf26cf3e53c6f2a1722e8ab62de3 >patches/3.patch | |
git format-patch -1 --stdout d7c13e31b502049c436d898b037729d08b6078a0 >patches/4.patch | |
git format-patch -1 --stdout e00ddb86adebb2d528a08abd91bfd7237d32a07e >patches/5.patch | |
git format-patch -1 --stdout 4caf820a1389c0bfba355513e0f64b015cdd0438 >patches/6.patch | |
git format-patch -1 --stdout 8f70172900068e799d284936078022e35fb1efb6 >patches/7.patch | |
git format-patch -1 --stdout b6353c9741962ff618f70773e53248800f6e449b >patches/8.patch | |
git format-patch -1 --stdout ad3fb2cb478ebae3d746744f6ba998cd32f93e0c >patches/9.patch | |
git format-patch -1 --stdout 8c4cd047526735530aad05bd47c03810317c51c1 >patches/10.patch | |
git format-patch -1 --stdout a1f0816682b8959b4adb96e84f7e79dd3ead22a9 >patches/11.patch | |
git format-patch -1 --stdout cb23fa4dce7e022635412490ec16b7d78f7428ed >patches/12.patch | |
git format-patch -1 --stdout 2a96d4a7327f00af5c55d8267e9f9b70c25a64f7 >patches/13.patch | |
git format-patch -1 --stdout 0ccd431814882a938c5b7647c57d05d6ba754e67 >patches/14.patch | |
git format-patch -1 --stdout bc7f552e4b6a9b0e317931730260cf0ea79767d6 >patches/15.patch | |
git format-patch -1 --stdout 01caa67cea415d34fdb8ef007ce64d839a639f71 >patches/16.patch | |
git format-patch -1 --stdout d3505238d53541dec8f3ca8080a7e22181d153b2 >patches/17.patch | |
git format-patch -1 --stdout dc09c49dee1861e1e817a48758e820a0b39bf2c3 >patches/18.patch # cleanup inputs file | |
git format-patch -1 --stdout 75a488ea3f1a23c12e2c0bf97ff47cdf0de84535 >patches/20.patch | |
git format-patch -1 --stdout 09cc9c0b0ee3639877a2bb4d17cc4d5d590b024d >patches/21.patch | |
git format-patch -1 --stdout c0240972bc5db292cccb9539a141121b233a7b6e >patches/22.patch | |
git format-patch -1 --stdout 58e293f63ae8d79d564d51b214844c2811cd45b0 >patches/23.patch | |
git format-patch -1 --stdout 84a75abeeb11aed7925d756146d0f9c0c4314666 >patches/24.patch | |
git format-patch -1 --stdout 7aa6085fadcc9b00e2637e94febe86f19adc1f40 >patches/25.patch | |
git format-patch -1 --stdout c4c7ecd92871a2b047852d285619bc65ecf8edb7 >patches/26.patch | |
git format-patch -1 --stdout 45dd84250c10ac092a4b9e1b477870755dc79ef2 >patches/27.patch | |
git format-patch -1 --stdout b50878734a6532717d5a1f752711ee128fbdb9ca >patches/28.patch | |
git format-patch -1 --stdout d4915c278af4f70a034d4771d20f93e3082a8c3e >patches/29.patch | |
git format-patch -1 --stdout 5e6b9641b78e030c45a6f1e501eb1411c81c7dc5 >patches/30.patch | |
git format-patch -1 --stdout 54de554387ee5fa8600e683909acbe0ec69a61d5 >patches/31.patch | |
git format-patch -1 --stdout 7864ce634849ca0ed4ce9b35bfd383fcad8ac9d8 >patches/32.patch | |
git format-patch -1 --stdout 80b0d4dccd0014aca075f76215b00c5f8e4cb737 >patches/33.patch # cleanup commit message | |
git format-patch -1 --stdout 28de8133ee7fe42258cfc50d35dc9792ac9dee3e >patches/34.patch | |
# afterwards, move the patch directory to somewhere in destination git repoB |
This file contains 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
#!/bin/bash | |
# apply the transfered patches from source repoA to destination repoB | |
git am < patches/1.patch | |
git am < patches/2.patch | |
git am < patches/3.patch | |
git am < patches/4.patch | |
git am < patches/5.patch | |
git am < patches/6.patch | |
git am < patches/7.patch | |
git am < patches/8.patch | |
git am < patches/9.patch | |
git am < patches/10.patch | |
git am < patches/11.patch | |
git am < patches/12.patch | |
git am < patches/13.patch | |
git am < patches/14.patch | |
git am < patches/15.patch | |
git am < patches/16.patch | |
git am < patches/17.patch | |
git am < patches/18.patch | |
git am < patches/20.patch | |
git am < patches/21.patch | |
git am < patches/22.patch | |
git am < patches/23.patch | |
git am < patches/24.patch | |
git am < patches/25.patch | |
git am < patches/26.patch | |
git am < patches/27.patch | |
git am < patches/28.patch | |
git am < patches/29.patch | |
git am < patches/30.patch | |
git am < patches/31.patch | |
git am < patches/32.patch | |
git am < patches/33.patch | |
git am < patches/34.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment