2017-02-20 77 views
1

我以共享帳戶登錄,並希望以自己的身份快速提交一些更改。hg commit -u的git相當於什麼?

與Mercurial我會與-u標誌

-u --user USER記錄中指定的用戶作爲提交者

hg commit -u '[email protected]' 

我試圖

git commit --author='John Doe <[email protected]>' 

做但沒有幫助。

由於該帳戶是共享的,這不利於 Using same git repository by multiple users

是使用git config,然後刪除它,當我真正做過的唯一途徑?

+1

雖然'--author' *做*工作(它設置提交的*作者*),它不會改變提交的*提交者*。要設置兩者,請參閱下面的吸血鬼答案(http://stackoverflow.com/a/42350173/1256452)。請注意,Mercurial沒有單獨的作者和提交者,只是作者。 – torek

回答

3

隨着-c可以覆蓋在命令行中運行任何Git配置設置。因此,就像

git -c user.name="John Doe" -c [email protected] commit 
+0

謝謝。我懷疑是從命令行傳遞配置選項的一種方法。我只是看錯了地方。 'man git'揭示'git help commit'沒有。 –

0

正常提交,然後與作者修改:

git commit --amend --author="Author Name <[email protected]>" 
+0

但通常提交我需要配置'user.name'和'user.email'。有沒有簡單的方法呢? –

+0

設置一個默認的,併爲非默認的。 –