svn 저장소에 3 년이 넘는 기록이있는 프로젝트가 있습니다. 그것은 git로 마이그레이션되었지만 이것을 한 사람은 지난 버전을 가져와이 3 년의 역사를 모두 버립니다.루트 커밋 부모를 다른 커밋 (두 개의 독립적 인 자식 저장소 연결)을 가리 키도록 변경하십시오.
프로젝트는 지난 3 개월에서 4 개월의 히스토리를 하나의 저장소에 가지고 있으며 다른 3 년간의 svn 히스토리를 새로운 git 저장소로 가져 왔습니다.
두 번째 저장소의 루트 커밋을 첫 번째 커밋의 마지막 커밋에 연결할 수있는 방법이 있습니까?
그것은이 같은 것입니다 :
* 2017-04-21 - last commit on master
|
* 2017-03-20 - merge branch Y into master
|\
| * 2017-03-19 - commit on branch Y
| |
* | 2017-03-18 - merge branch X into master
/| * 2017-02-17 - commit on another new branch Y
* |/ 2017-02-16 - commit on branch X
| * 2017-02-15 - commit on master branch
* | 2017-01-14 - commit on new branch X
\|
* 2017-01-13 - first commit on new repository
|
* 2017-01-12 - init new git project with the last version of the code in svn repository
.
.
There is no relationship between the two different repositories yet, this is what I wanna
do. I want to connect the root commit of 2nd repository with the last commit of the first
one.
.
.
* 2017-01-09 - commit
|
* 2017-01-08 - commit
|
* 2017-01-07 - merge
/|
* | 2016-01-06 - 2nd commit the other branch
| * 2016-01-05 - commit on trunk
* | 2016-01-04 - commit on new branch
\|
* 2015-01-03 - first commit
|
* 2015-01-02 - beggining of the project
업데이트 :
난 그냥 내가git rebase
하지만, 어떻게해야 할 것을 알게
? SHA-1 코드와 같은 커밋 날짜를 고려해 보겠습니다. 대답은 --parent-filter
옵션을 사용하는 git filter-branch
옵션을 사용하는 것이고 git rebase
이 아닌 것입니다.
업데이트 2 :
PS D:\git\rebase-test\rep2cc> git filter-branch --parent-filter 'test $GIT_COMMIT = 443aec8880e898710796a1c4fb4decea1ca5ff66 && echo "-p 98e2b95e07b84ad1e40c3231e66840ea910e9d66" || cat' HEAD
fatal: ambiguous argument '98e2b95e07b84ad1e40c3231e66840ea910e9d66 || cat': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
업데이트 3 : I 명령 git filter-branch --parent-filter 'test $GIT_COMMIT = 443aec8880e898710796a1c4fb4decea1ca5ff66 && echo "-p 98e2b95e07b84ad1e40c3231e66840ea910e9d66" || cat' HEAD
을 시도하고 작동하지 않았다
그것은 윈도우 CMD에서 작동하지 않았거나 PowerShell,하지만 창에 힘내 배쉬에서 작동하지 않았다.
글쎄, 같은 저장소 내에서 양쪽 모두를 가져 와서 다른 하나의 리포지토리를 리베이스하는 것을 고려 해보았습니까?이것은 물론 리베이스하는 히스토리의 모든 커밋을 다시 작성합니다. –
Lasse가 올바르게 처리했습니다. 그냥 정확하게 svn 복제 된 svn 새 repo 설정,이 파열 된 repo 함께 원격 추가 fetch 및 체리 - 올바르게 복제 된 svn repo svn에서 복제 후 자식에서 수행 된 기록을 선택하십시오. – eftshift0
나는 자식에 대해 새로운 데, 나는 찾고 있던 마법의 단어가 'rebase'라는 것을 배웠다. – lmcarreiro