git總結修改提交的author和email

來源:互聯網
上載者:User
在git倉庫中,輸入git log命令,可以查看所有的commit。 $ git log commit 81dc0f187181f228db185f0733831ed7b84ceb56 Author: 使用者1 <abc@xxxcom> Date:   Thu Sep 24 17:04:49 2015 +0800  database password kms 

那麼可以看到author和email。今天發現了一個問題。我之前用的是個人的qq email作為github的提交。公司用的是公司的email提交代碼。所以要修改git的email。
1.查看~/.gitconfig $ cat ~/.gitconfig [user] name =xiaoming email = xiaoming@qq.com 可以看到全域的git name和email,所有的提交都是使用這個。
2.有3種辦法修改提交name和email (1)修改  全域的gitconfig,適用於當前登陸使用者    $git config --global user.email "xiaoming1@xxx.com"
         $git config --global user.email "xiaoming1@xxx.com”   (2)修改  項目中的gitconfig,適用於當前項目。        目前的目錄(.git/config)下查看gitconfig   $ cat ./.git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = xxxx.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master   這些屬性都可以改。如預設bare為false,改成true如下操作。      $git config  core.bare true   修改name和email (3)修改系統配置。適用於所有系統中所有使用者。一般不這麼幹,不然使用者梯度就沒意義了。修改的是全域的設定檔/etc/gitconfig。       $sudo git config --system core.editor vim

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.