我希望能够为脚本执行此操作。我基本上是在 Git 中重新创建某些代码的整个版本历史记录——它目前使用不同的版本控制系统。我需要脚本能够将提交添加到 Git,同时保留提交的原始作者(和日期)。
假设我知道提交作者和进行更改的日期/时间,是否有 Git 命令允许我执行此操作?我假设有,因为 git-p4 做了类似的事情。我只是要求最好的方法。
最佳答案
查看 --author
git commit
的选项:
来自man page :
--author=<author>
Override the commit author. Specify an explicit author using the standard
A U Thor <author@example.com>
format. Otherwise<author>
is assumed to be a pattern and is used to search for an existing commit by that author (i.e.rev-list --all -i --author=<author>
); the commit author is then copied from the first such commit found.
关于git - 您如何以不同的用户身份提交代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3696938/