Skip to content

Instantly share code, notes, and snippets.

@shield-9
Last active December 26, 2017 19:11
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 shield-9/16eec5e1cf9ce813f24267d0e5532ded to your computer and use it in GitHub Desktop.
Save shield-9/16eec5e1cf9ce813f24267d0e5532ded to your computer and use it in GitHub Desktop.
[ACA17] gitの既存レポジトリを移動する方法
for i in `git branch|sed -e 's/^[* ]*//'`
do
git checkout $i
git stash
git rebase origin/$i
done
git checkout master
for i in `git branch -r|grep -v HEAD|grep -v master|sed 's:origin/::g'`
do
git checkout --track -b $i origin/$i
done
git checkout master
## ここらへんでgitのremoteを書き換える (おすすめ: sed > git-remote > vim >> emacs)
git push --all
git push --tags

普通の時の手順も一応。こっちだと、GitHubからIssue(とPull Request)も取り込めます。

git clone --mirror 旧repo
cd repo名
git aisp repo-create repo名
git push --mirror 新repo

cd ..

git gh-issue clone --mirror 旧repo
cd repo名-issues
git aisp issue-push --mirror --old-type=aisp 新repo

※GitHub Enterpriseを使っていた場合はgit gh-issue --helpでマニュアルを確認してください。


コマンド打ちたくない人向け

ちなみにこれが面倒な場合は、https://repo.aisp/add-repository から「Import existing repository」->「GitHub」を選択してください。

GitHub以外

  • GitLabとか: 「Other git server」を選択
  • 手元の作業環境しか残っていない: 「Local git repository」を選択

サポートとか

これでもダメなら、http://orca.aisp/creative-support/tools/repo で助けを求めて下さい。 (メールアドレスの末尾がcreative.aisp以外の場合は http://chat.creative.aisp/support/tools/repo)

※現時点で、GitHub以外からのメタデータのインポートには対応していません。

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