git合并或合并同一分支和同一存储库中的两个文件

git合并或合并同一分支和同一存储库中的两个文件,git,Git,我遇到过这样一种情况:有人在一个文件夹中启动了一个文件并进行了多次提交,然后在另一个文件夹中提交了一个副本并进行了多次提交。我想将这些文件合并到一个文件中,并保留历史记录 git rm <good-location/file> git commit -m 'Removing bad file form good location' git mv <bad-location/file> <good-location/file> git commit -m 'Mo

我遇到过这样一种情况:有人在一个文件夹中启动了一个文件并进行了多次提交,然后在另一个文件夹中提交了一个副本并进行了多次提交。我想将这些文件合并到一个文件中,并保留历史记录

git rm <good-location/file>
git commit -m 'Removing bad file form good location'
git mv <bad-location/file> <good-location/file>
git commit -m 'Moving file to correct location'
git log --follow -- <good-location/file>
第二份副本较新且正确,但位于错误的文件夹中。较旧的文件可以被较新的文件覆盖

我可以复制和粘贴内容,但我会丢失历史记录。

似乎git log--follow--显示我移动的文件的历史记录,git log--显示我删除的文件的历史记录以及git mv commit。我对git还是相当陌生的。谢谢你的帮助
git rm <good-location/file>
git commit -m 'Removing bad file form good location'
git mv <bad-location/file> <good-location/file>
git commit -m 'Moving file to correct location'
git log --follow -- <good-location/file>