如何将项目的备份副本手动导入到 Git 中?
在手动创建我的小项目的分支和副本之后,我终于在没有经验的情况下尝试使用 git。如何导入所有这些手动副本?
After manually making branches and copies of my small project, I'm finally trying using git with no experience. How do you import all of these manual copies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您觉得值得将所有旧历史记录导入 Git,那么就可以这样做。然而,手动导入历史记录可能非常繁琐,尤其是对于多个分支。有些人编写了脚本将现有 VCS 中的代码导入到 Git 中,但显然这不能直接用于手动副本。
我会考虑您是否真的需要 Git 中的所有历史副本。如果没有,请开始对当前代码使用基本的 Git 操作,并从现在开始继续。
如果您仍然想手动导入历史记录,可以通过以下简单方式进行操作:
如果您在修订之间删除了文件,则还必须使用
git rm
以及git add
来完整记录历史。高级使用上述内容可以让您将提交日期和时间从当前时间更改为您喜欢的任何时间戳。If you feel that it's worthwhile to import all your old history into Git, it's possible to do so. However, manually importing history can be pretty tedious, especially with multiple branches. Some people have written scripts to import code in an existing VCS into Git, but obviously that wouldn't directly work for your manual copies.
I would consider whether you really need all the historical copies in Git. If not, then start using the basic Git operations with your current code and move forward from now.
If you still want to manually import history, here's how you could do it in a simple manner:
If you have removed files between revisions, you'll also have to use
git rm
as well asgit add
to fully record history. Advanced use of the above can let you change the commit date and time from the current time to whatever timestamp you like.