栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

git change email by filter-branch/set local git email

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

git change email by filter-branch/set local git email

[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 
Date:   Mon Nov 16 14:50:45 2020 +0800

    patch and kernel config

commit 63f0232cfc58c7fb19ea02cdd527f9a09193f37b
Author: Lake Hu 
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 
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 		   ------------>  Changed 
Date:   Mon Nov 16 14:50:45 2020 +0800             ------------>  No change!!! 

    patch and kernel config

commit 193b8f69e010728a6028ba1971c872d3dd00f364
Author: Lake Hu 
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 
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]$


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/311014.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号