Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 git repo 中,我不小心将文件 , 移动A到B,而不是删除A并创建一个全新的B.
A
B
如何在变基期间删除A并创建新的?B
要回答您的问题,您无法在一次提交中执行任何操作来区分删除+创建和重命名。如果您可以将删除和创建分成单独的提交,这将阻止 Git 将操作识别为重命名。
根据维基百科的 Git 文章:
Git 通过在浏览快照历史时检测重命名而不是在制作快照时记录它来解决这个问题
“问题”是跟踪重命名文件的历史记录的难度。