공부/git
Git Repository 를 복사해서 새로운 Repository 만드는 방법
챠오위
2022. 5. 9. 23:40
Git Repository 의 현재 버전을 복사해서 다른 프로젝트에 활용하고자 한다.
`git clone` 의 `mirror` 옵션으로 모든 이력을 가지고 온 뒤, github 상에 새로 만든 repository 에 `push` 한다.
먼저 다음과 같이 복사할 repository 를 `--mirror` 옵션으로 `clone` 한다.
`--mirror` 옵션을 넣으면 커밋 이력까지 함께 가지고 온다.
> git clone --mirror <옮길 repository 주소>
이때 {프로젝트명}.git 디렉토리가 생성된다.
> cd {프로젝트명}.git
remote push url 을 github 에 새로 만든 repository 로 변경한다.
`git remote set-url --push origin <새로운 repository 주소>
`--mirror` 옵션으로 통째로 `push` 한다.
> git push --mirror
참고)
기존 Git Repository를 복사하여 새로운 Repository 만들기 (tistory.com)
기존 Git Repository를 복사하여 새로운 Repository 만들기
보통 Git Repository를 복사할 때 fork 를 많이 사용한다. fork 는 사실상 clone 과 큰 차이가 없지만, github.com 내에서 바로 검색이 되진 않는다. fork 의 원래 의도는 bugfix를 위해 기존 repository를 복사하..
projooni.tistory.com