如何将文件夹和文件移动到新文件夹并保留历史记录? [重复]

问题描述 投票:0回答:1
我想将文件夹及其中的文件移动到新文件夹。文件夹名称和文件名称均已更改。

Dir1 file11 file12 TO Dir2 file21 file22

我也想保留历史。 

我可以一次提交吗?还是我需要以下两个步骤?

git mv Dir1 Dir2 commit and push git mv Dir2/file11 Dir2/file21 git mv Dir2/file11 Dir2/file22 commit and push

git github git-commit
1个回答
2
投票
是的,您只能通过一次提交来执行此操作:

git mv Dir1 Dir2 git mv Dir2/file11 Dir2/file21 git mv Dir2/file11 Dir2/file22 commit and push

您也可以在两次提交中执行此操作,并根据需要使用git rebase -i HEAD~3压缩它们。
© www.soinside.com 2019 - 2024. All rights reserved.