码迷,mamicode.com
首页 > 其他好文 > 详细

git filter-branch

时间:2019-05-29 10:37:39      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:new   env   one   targe   wro   cti   range   its   git   

https://github.com/git-for-windows/git/issues/2206

https://git-scm.com/docs/git-filter-branch

The --env-filter option can be used to modify committer and/or author identity. For example, if you found out that your commits have the wrong identity due to a misconfigured user.email, you can make a correction, before publishing the project, like this:

git filter-branch --env-filter ‘
	if test "$GIT_AUTHOR_EMAIL" = "root@localhost"
	then
		GIT_AUTHOR_EMAIL=john@example.com
	fi
	if test "$GIT_COMMITTER_EMAIL" = "root@localhost"
	then
		GIT_COMMITTER_EMAIL=john@example.com
	fi
‘ -- --all

To restrict rewriting to only part of the history, specify a revision range in addition to the new branch name. The new branch name will point to the top-most revision that a git rev-list of this range will print.

Consider this history:

     D--E--F--G--H
    /     /
A--B-----C

To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use:

git filter-branch ... C..H

To rewrite commits E,F,G,H, use one of these:

git filter-branch ... C..H --not D
git filter-branch ... D..H --not C

 

git filter-branch

标签:new   env   one   targe   wro   cti   range   its   git   

原文地址:https://www.cnblogs.com/chucklu/p/10942117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!