Skip to content

Instantly share code, notes, and snippets.

@DanielTimLee
Created October 16, 2022 10:31
Show Gist options
  • Save DanielTimLee/bdd769ba7a78ddb6bdc7690ad54e529b to your computer and use it in GitHub Desktop.
Save DanielTimLee/bdd769ba7a78ddb6bdc7690ad54e529b to your computer and use it in GitHub Desktop.
merge_repo_FROM_TO
#!/bin/bash
# $FROM_REPO를 $TO_REPO에 합친다.
# 이 스크립트는 $TO_REPO에 $FROM이라는 이름의 디렉터리를 만들고
# 해당 디렉터리 아래에 $FROM_REPO 내용을 붙여넣습니다. (commit까지 전부 복사)
FROM_REPO=https://github.com/aiden2978/flask-hogugi.git
FROM=flask-hogugi
TO_REPO=https://github.com/osamhack2022/WEB_HOGUGI_MARCH
TO=WEB_HOGUGI_MARCH
echo "Cloning $FROM repo"
git clone $FROM_REPO $FROM
cd $FROM
git filter-repo --to-subdirectory-filter $FROM
cd ..
echo "Cloning $TO repo"
git clone $TO_REPO $TO
cd $TO
git pull
git remote add $FROM ../$FROM
git fetch $FROM
git merge --allow-unrelated-histories $FROM/main
git remote remove $FROM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment