Skip to content

Conversation

gadfly3173
Copy link
Contributor

@gadfly3173 gadfly3173 commented May 25, 2025

image

If a username or email is specified, pass it to commit via -c (--author is not used to allow default values when the repository's config is not read). If UseAmend is enabled and the specified user information differs from the commit, modify the user information via -c and --reset-author.

@love-linger
Copy link
Collaborator

我不建议这样做。如果是针对于对已有提交的重新编辑(比如amend,interactive rebase中的edit/reword,解决cherry-pick冲突等操作),我建议是在提交中指定 Co-authored-by,这样可以正确表明该提交是由多个人共同编辑的。而直接修改author,会丢失这一重要信息。

@gadfly3173
Copy link
Contributor Author

gadfly3173 commented May 26, 2025

那就直接去除--reset-author的部分就可以。我本来的目的是为了比较方便地修改用错误的git用户信息提交的commit。或者给reset-author添加一个按钮

@gadfly3173
Copy link
Contributor Author

处理了冲突,并且去除了Squash中的修改。Squash不应默认使用--reset-author,交互式变基中的squash并不会做这个操作。

@love-linger
Copy link
Collaborator

现在,在启用--amend选项后,允许--reset-author(这会从使用 git config user.name/user.email)。为什么还需要提交时手动指定用户与邮箱呢?

@gadfly3173
Copy link
Contributor Author

image
Jetbrains 的IDEA有类似功能,所以我想添加一下

@gadfly3173 gadfly3173 closed this May 28, 2025
@gadfly3173 gadfly3173 deleted the fix/reset-author branch June 3, 2025 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants