Skip to content

Instantly share code, notes, and snippets.

@neetsdkasu
Last active May 11, 2020 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neetsdkasu/31a2e07c355199d22581d02482c38a92 to your computer and use it in GitHub Desktop.
Save neetsdkasu/31a2e07c355199d22581d02482c38a92 to your computer and use it in GitHub Desktop.
リポジトリコピー・・・
#!/bin/sh
echo '#!/bin/sh' > doitdoit.sh
git branch -a | grep -v master|HEAD | sed -r -e s/.*origin\\/\(.*\)/git\ branch\ \\1\ origin\\/\\1/ >> doitdoit.sh
git remote | grep -v origin | sed -r -e s/\(.*\)/git\ push\ \\1\ --all\\ngit\ push\ \\1\ --tags/ >> doitdoit.sh
./doitdoit.sh
rm doitdoit.sh
@neetsdkasu
Copy link
Author

neetsdkasu commented May 11, 2020

リモートのhogehogeサイトに置いてあるリポジトリhogeを
別のリモートのfugafugaとpiyopiyoにコピーしたいときに使うスクリプト

git clone git@hogehoge~~/hoge.git
cd hoge
git remote add fuga git@fugafuga~~/hoge.git
git remote add piyo git@piyopiyo~~/hoge.git

ここで

./pick.sh

を実行

pick.shは origin/* のブランチからローカルブランチを作ってorigin以外のリモートにpush --allpush --tagsを実行する doitdoit.sh というスクリプトを生成して それを実行する

@neetsdkasu
Copy link
Author

neetsdkasu commented May 11, 2020

grepsedも難しい、全くわからん・・・

特にsedがイミフ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment