2014년 10월 15일 수요일

merge remote git project!

다른 repository의 git project를 merge 하려면?

1. remote server의 정보를 추가
2. fetch(정보를 받아옴)
3. merge

간단하다.
.git/config를 열어보면 다음과 같이 remote server의 주소가 있다

[remote "A"]
         url = ssh://address = server/address
         projectname = project/name
         fetch = +x:x

나는 remote B의 git을 merge 할 것이다. 그러려면 remote B의 서버 주소가 필요하다.
 git remote add [-t ] [-m ] [-f] [--tags|--no-tags] [--mirror=]
<예시>
$ git remote add -t branch myname ssh://xxx
그러면, .git/config에 다음이 추가된다.
[remote "lap_8916_kk"]
         url = ssh://xxx
         fetch = +y:y

그런 뒤
$ git fetch myname
하면 fetch를 하고,
$git merge myname/branch
하면 merge가 시작된다.

참 쉽죠잉?

댓글 없음: