[lake@localhost linux-stable]$ git config --global alias.change-commits '!'"f() { VAR=\$1; OLD=\$2; NEW=\$3; shift 3; git filter-branch --env-filter \"if [[ \\\"\$\`echo \$VAR\`\\\" = '\$OLD' ]]; then export \$VAR='\$NEW'; fi\" \$@; }; f"
[lake@localhost linux-stable]$ cat ~/.gitconfig
[user]
name = Lake Hu
email = lake@localhost
[alias]
[alias]
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" $@; }; f"
[kreatv]
autoFormatSourceCode = true
[core]
editor = vim
autocrlf = input
[color]
ui = auto
[lake@localhost linux-stable]$
Example:
[lake@localhost linux-stable]$ git log
commit 38b45955d1e2d33a43a7c0d4b03c295fbd0a9f38 (HEAD -> brcm_4.9.132)
Author: Lake Hu <lake@localhost>
Date: Mon Nov 16 14:50:45 2020 +0800
patch and kernel config
commit 63f0232cfc58c7fb19ea02cdd527f9a09193f37b
Author: Lake Hu <lake@localhost>
Date: Mon Nov 16 14:45:01 2020 +0800
4.9-1.10.tar.bz2, Dec 14 2018
commit 3622426cc93ab5bc75fa9cf2e897441dff894c34 (tag: v4.9.132)
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed Oct 10 08:53:23 2018 +0200
Linux 4.9.132
[lake@localhost linux-stable]$ git change-commits GIT_AUTHOR_EMAIL "lake@localhost" "lake.hu@outlook.com" HEAD~3..HEAD
WARNING: git-filter-branch has a glut of gotchas generating mangled history
rewrites. Hit Ctrl-C before proceeding to abort, then use an
alternative filtering tool such as 'git filter-repo'
(https://github.com/newren/git-filter-repo/) instead. See the
filter-branch manual page for more details; to squelch this warning,
set FILTER_BRANCH_SQUELCH_WARNING=1.
Proceeding with filter-branch...
Rewrite 38b45955d1e2d33a43a7c0d4b03c295fbd0a9f38 (3/3) (0 seconds passed, remaining 0 predicted)
Ref 'refs/heads/brcm_4.9.132' was rewritten
[lake@localhost linux-stable]$
[lake@localhost linux-stable]$
[lake@localhost linux-stable]$
[lake@localhost linux-stable]$
[lake@localhost linux-stable]$ git log
commit 92ba1220faf2a11b57b1f93abdad80e627c5dd47 (HEAD -> brcm_4.9.132)
Author: Lake Hu <lake.hu@outlook.com> ------------> Changed
Date: Mon Nov 16 14:50:45 2020 +0800 ------------> No change!!!
patch and kernel config
commit 193b8f69e010728a6028ba1971c872d3dd00f364
Author: Lake Hu <lake.hu@outlook.com>
Date: Mon Nov 16 14:45:01 2020 +0800
4.9-1.10.tar.bz2, Dec 14 2018
commit 3622426cc93ab5bc75fa9cf2e897441dff894c34 (tag: v4.9.132)
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed Oct 10 08:53:23 2018 +0200
Linux 4.9.132
############## set local git email
[lake@localhost linux-stable]$ git config user.email
lake@localhost
[lake@localhost linux-stable]$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
fetch = +refs/heads/*:refs/remotes/origin/*
[lake@localhost linux-stable]$ git config user.email lake.hu@outlook.com
[lake@localhost linux-stable]$ git config user.email
lake.hu@outlook.com
[lake@localhost linux-stable]$
[lake@localhost linux-stable]$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
fetch = +refs/heads/*:refs/remotes/origin/*
[user]
email = lake.hu@outlook.com
[lake@localhost linux-stable]$
git change email by filter-branch/set local git email
最新推荐文章于 2025-01-16 12:32:48 发布