Created
June 28, 2018 21:53
-
-
Save pocc/8f282d57bb9612e6a9cb4ccb16ad316c to your computer and use it in GitHub Desktop.
Converts a repo to a branch on another repo
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
#!/bin/bash | |
# This script will move the files in a repository into a branch in another repository | |
# arg 1 is file source repo 1, arg 2 is repo 2 that will get a new branch | |
# arg 3 is repo 1 name, arg 4 is repo 2 name, arg 5 is the branch name | |
# Get files | |
cd /tmp | |
git clone $1 | |
git clone $2 | |
cd $4 | |
# Move project's git folder to parent, copy files over, and move it back | |
mv .git .. | |
rm -rf * | |
cp -rP ../$4/. . | |
rm -rf .git | |
mv ../.git . | |
# Create dev branch | |
git branch $5 | |
git checkout $5 | |
git add . | |
git commit -m "created $5 branch from $3" | |
git push -u origin $5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment