svn リポジトリに 3 年以上の歴史を持つプロジェクトがあります。それはgitに移行されましたが、これを行った人は、最後のバージョンを取得して、これらの3年間の履歴をすべて破棄します.
現在、プロジェクトには 1 つのリポジトリに過去 3 ~ 4 か月の履歴があり、他の 3 年間の svn 履歴を新しい git リポジトリにインポートしました。
2 番目のリポジトリのルート コミットを最初のリポジトリの最後のコミットに接続する方法はありますか?
それは次のようなものです:
* 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コードのようにコミット日を考えてみましょう...git filter-branchすることでした。--parent-filtergit rebase
更新 2:
コマンドを試しましたが、git filter-branch --parent-filter 'test $GIT_COMMIT = 443aec8880e898710796a1c4fb4decea1ca5ff66 && echo "-p 98e2b95e07b84ad1e40c3231e66840ea910e9d66" || cat' HEADうまくいきませんでした:
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:
Windows CMD や PowerShell では機能しませんでしたが、Windows の Git Bash では機能しました。