cytopia/git-rewrite-author

重写git作者和提交者历史(本地和远程)。

0.2 2015-10-10 19:40 UTC

This package is auto-updated.

Last update: 2024-09-12 03:43:44 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License POSIX Type

git-rewrite-author 是一个用于操作git作者和提交者历史的shell工具。您可以使用此工具将特定的git作者/提交者邮箱替换为另一个邮箱。

例如: 您不小心从生产服务器提交并推送了紧急内容...

commit 70dbf556b735a7e1729f79b36502829415c037dd
Author: Charly Root <root@localhost>
Date:   Sat Oct 10 18:30:01 2015 +0200

    Applied Security Fix

...现在您看到git作者历史已经不太整洁了。这可以改变吗?当然可以 :-)

更多详细信息请查看 everythingcli.org

1. 功能

  • 列出所有当前git作者和提交者(姓名和邮箱)
  • 通过邮箱搜索作者/提交者并替换为不同的姓名和邮箱
  • 显示所有命令的工作方式(--dry 选项)

2. 使用方法

2.1 所有选项

Usage: git-rewrite-author -l [--dry]
       git-rewrite-author -r <old_email> <new_email> <new_name> [--dry]
       git-rewrite-author -h
       git-rewrite-author -v

 -l       List current authors and committers in git
 -r       Rewrite history from <old_email> to <new_email> and <new_name>
 --dry    (optional) Do not do anything, just print the command.
 -v       Show version information.
 -h       Show this help screen.

2.2 列出所有作者

$ git-rewrite-author -l
cytopia <cytopia@everythingcli.org>

2.3 替换作者

# Rewrite hisstory
$ git-rewrite-author -r "cytopia@everythingcli.org" "better@email.com" "Cool Name"

# See who is left in the history
$ git-rewrite-author -l
Cool Name <better@email.com>

3. 安装

您可以通过git或composer下载 git-rewrite-author

# git
git clone -https://github.com/cytopia/git-rewrite-author.git

# composer
composer require cytopia/git-rewrite-author

之后,只需执行 install.sh,它将简单地创建到您家目录的二进制文件符号链接。因此,在之后更新git仓库时,符号链接将始终指向该版本。

$ ./install.sh
Symlink git-rewrite-author to ~/bin? (Y/n)y

4. 贡献

欢迎贡献者。

5. 许可证

license