GIT 查询代码量等操作

查询代码量

git log --author="Professor X" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -

修改已提交记录的邮箱和用户名

#!/bin/sh

git filter-branch --env-filter '

OLD_EMAIL="zhanwj@28446aec-c389-f948-8ca4-81f8ef89eef3"
CORRECT_NAME="Professor X"
CORRECT_EMAIL="zhanwj@mail.com"

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

修改 OLD_EMAIL 被修改的邮箱
修改 CORRECT_NAME 替换用户名
修改 CORRECT_EMAIL 替换邮箱

posted @ 2020-03-17 15:46  Jay·Chan  阅读(1591)  评论(0编辑  收藏  举报