如何以不同的用户身份提交代码? [英] How do you commit code as a different user?

查看:223
本文介绍了如何以不同的用户身份提交代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要能够为一个脚本做到这一点。我基本上重新创建一些代码在Git的整个版本历史 - 它目前使用不同的版本控制系统。我需要脚本能够添加提交到Git,同时保留提交的原始作者(和日期)。

I want to be able to do this for a script. I'm essentially re-creating the entire version history of some code in Git - it currently uses a different version control system. I need the script to be able to add in the commits to Git while preserving the commit's original author (and date).

假设我知道提交作者和日期/时间的改变,是否有一个Git命令,让我这样做?我假设有,因为git-p4做类似的事情。我只是要求做最好的方法。

Assuming I know the commit author and the date/time the change was made, is there a Git command that allows me to do this? I'm assuming there is, because git-p4 does something similar. I'm just asking for the best way to do it.

推荐答案

查看<$ c $的 - 作者选项c> git commit :

Check out the --author option for git commit:

手册页


- author = author>

覆盖提交作者。使用标准 A U Thor< author@example.com> 格式指定明确的作者
。否则
< author> 被假定为模式
,用于搜索该作者的现有
提交 rev-list --all -i --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.

这篇关于如何以不同的用户身份提交代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆