2017-09-25 7 views
0

다른 프로젝트를 git 하위 트리로 포함하는 프로젝트를 만들고 싶습니다. 이 하위 트리는 최근 릴리스 버전을 기준으로합니다. 하위 트리 프로젝트의 릴리스는 태그로 수행됩니다.태그를 기반으로하는 서브 트리 리모트에 기여하는 방법

자, 저는 서브 트리 리모트에 기여할 방법을 찾아 내려고하고 있습니다.

이 하위 트리가 포함 된 프로젝트 내에서 하위 트리 원격 리포지토리에 기여할 수 있음을 알고 있습니다. 태그가 아니라 지점을 기반으로 할 때만 작동하는 것으로 보입니다. 나를 위해 작동하지 않습니다

시나리오 :

git subtree add --prefix libs/my_lib my_lib RELEASE_TAG --squash 
vi libs/my_libs/file.txt 
git add . 
git commit -m"Change" 
git subtree push --prefix libs/my_lib my_lib new_branch 

출력 :

git push using: my_lib new_branch 
fatal: 42bb2d35f859596b7ee5ae37134fa3209ffbb2f1 is not a valid 'commit' object 
Can't copy commit e0364bf8b064ea60f70f9b197da4605dba28a252 

이 태그를 사용하지 않지만 내가, 내가 그런 식으로 그것을 할 수 있다는 사실을 알고 :

git subtree add --prefix libs/my_lib my_lib master --squash 
vi libs/my_libs/file.txt 
git add . 
git commit -m"Change" 
git subtree push --prefix libs/my_lib my_lib new_branch 
git push 

태그 기반 하위 트리 추가는 분기 기반 하위 트리 추가와 어떻게 다릅니 까? 실제로 다르다면 태그를 기반으로하는 서브 트리 리모컨으로 푸시하는 적절한 방법은 무엇입니까?

편집 :
시스템 : 페도라 22
Git 버전 : 2.4.11

답변

0

내 WIN7에 시도, 그것은 다음 단계로 노력하고 있습니다 :

git remote add to_other <url_to_other> 
git fetch to_other 

git subtree add --squash --prefix my_libs/other to_other REL_TEST 

# do a change 
date > my_libs/other/test_file.txt 
git add my_libs/other 
git commit -m "new file" my_libs/other 

# do push 
git subtree --squash push --prefix my_libs/other to_other my_branch 

이것은을 만듭니다 to_other의 새 지점 "my_branch".

아마도 git 버전에 문제가 있습니까?

$ git --version 
git version 2.12.0.windows.1 
+0

안녕하세요, 사실 특정 Git 버전과 관련된 문제가있는 것으로 보입니다. Windows에서 git 2.10으로 시도했지만 작동했지만 2.14 (또는 Windows에서도) 그렇지 않았습니다. – CAdr