git tips - githeim/windheim_archive GitHub Wiki

Git tips

Create new repository from the existing repository with its commits

$ mkdir /path/to/new_repo
$ cd /path/to/new_repo
$ git --bare init
$ cd /path/to/existing_repo
$ git push ssh://my_host/new_repo +existing_repo_branch:new_repo_branch

기존 repository에서 다른 repository로 history - commit들을 포함하여 이전하는 방법

두 개의 remote repository를 상정한다 ssh://REMOTE_A ssh://REMOTE_B

REMOTE_A의 history를 포함해서 commit들을 REMOTE B로 옮긴다

git clone ssh://REMOTE_A 
git remote add remote_b ssh://REMOTE_B
git push remote_b main(<--branch name)