我试着像这样做
git commit --author='Paul Draper <my@email.org>' -m 'My commit message'
Run Code Online (Sandbox Code Playgroud)
但我明白了
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
Run Code Online (Sandbox Code Playgroud)
我可以设置这些,但我在一个共享的盒子上,我必须(想)之后取消它们.
git config user.name 'Paul Draper'
git config user.email 'my@email.org'
git commit -m 'My commit message'
git config --unset user.name
git config --unset user.email
Run Code Online (Sandbox Code Playgroud)
这是一个提交的很多行!
有更短的路吗?
tor*_*rek 102
(在使用环境变量建议长版本之后,我发生了这种情况 - git commit想要设置作者和提交者,并且--author只覆盖前者.)
所有git命令-c在动作动词之前接受参数来设置临时配置数据,因此这是完美的地方:
git -c user.name='Paul Draper' -c user.email='my@email.org' commit -m '...'
Run Code Online (Sandbox Code Playgroud)
Kpy*_*pym 13
您可以.git/config在repo中编辑文件以添加以下别名:
[alias]
paulcommit = -c user.name='Paul Draper' -c user.email='my@email.org' commit
Run Code Online (Sandbox Code Playgroud)
或者您可以通过命令行执行此操作:
git config alias.paulcommit "-c user.name='Paul Draper' -c user.email='my@email.org' commit"
Run Code Online (Sandbox Code Playgroud)
然后你可以这样做:
git paulcommit -m "..."
Run Code Online (Sandbox Code Playgroud)
备注:
jeancommit,georgecommit...这个共享盒的其他用户..gitconfig或--global在添加别名时向命令行添加选项,将此别名添加到全局配置中.paulcommit不是一个短的,但它是冗长的,你通常只能键入git pau+ tab.| 归档时间: |
|
| 查看次数: |
20795 次 |
| 最近记录: |