2016-04-07 4 views
0

gitの履歴を書き換える必要がある理由は、私の名前が重複しており、リモートの2人の開発者としてカウントされるためです。git rewrite:著者名を変更しない

また、私のチームは最近、未知の著者名を拒否する事前受信フックを追加しました。

すぐに問題を解決する必要があるので、私はhttps://help.github.com/articles/changing-author-info/と他のいくつかのガイドに従って、作成者の名前をコミットから書き直してみました。

これは私が今使っているものです:

#!/bin/sh 

git filter-branch --env-filter ' 

OLD_EMAIL="[email protected]" 
CORRECT_NAME="Tomas Prado" 
CORRECT_EMAIL="[email protected]" 

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] 
then 
    export GIT_COMMITTER_NAME="$CORRECT_NAME" 
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" 
fi 
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] 
then 
    export GIT_AUTHOR_NAME="$CORRECT_NAME" 
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" 
fi 
' --tag-name-filter cat -- --branches --tags 

問題

これは、私の名前それはあなたが見

commit 355ee6adb0540d3e2eed7163dfe36087f85feb78 
Author: tomasp <[email protected]> 
Date: Wed Apr 6 13:35:25 2016 +0200 

    Fix hashed 

を変更する必要がありますコミットする必要がありますです"Tomas Prado"であるが、それは "tomasp"だ。

githubスクリプトを実行した後も、同じままです。 私は何をすべきかわかりません。

答えて

0

代わりに--commit-filterを使用してください。

git filter-branch --commit-filter ' 
    if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ]; 
    then 
      GIT_AUTHOR_NAME="Tomas Prado"; 
      GIT_AUTHOR_EMAIL="[email protected]"; 
      if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; 
      then 
       GIT_COMMITTER_NAME="Tomas Prado"; 
       GIT_COMMITTER_EMAIL="[email protected]"; 
       git commit-tree "[email protected]"; 
      else 
       git commit-tree "[email protected]"; 
      fi 
    else 
      if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; 
      then 
       GIT_COMMITTER_NAME="Tomas Prado"; 
       GIT_COMMITTER_EMAIL="[email protected]"; 
       git commit-tree "[email protected]"; 
      else 
       git commit-tree "[email protected]"; 
      fi 
    fi' HEAD 
関連する問題