自动重新措词所有重新提交的提交 [英] Automatically reword all rebased commits

查看:63
本文介绍了自动重新措词所有重新提交的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在将提交消息推送到远程设备之前对其进行修饰,但是我希望能够自动做到这一点.

I want to be able to touch up my commit messages before I push them to my remote, but I want to automatically do that.

我可以通过这样做重新措辞我所有的其他提交

I can reword all my additional commits by doing

git rebase -i origin/master

这将调出一个编辑器,在这里我可以将所有提交从pick更改为reword.然后它将调出编辑器,让我可以修改提交消息.

This brings up an editor where I can change all the commits from pick to reword. Then it will bring up editors where I can touch up my commit messages.

约束摘要:

  • 我不想每次更改对reword的提交.
  • 我不想手动输入每个提交哈希.
  • I don't want to have to change every commit to reword.
  • I don't want to manually type in every commit hash.

有没有办法像这样重新设定基准?

Is there a way to do rebase like this?

推荐答案

由于该问题对编辑的性质含糊不清,因此这些只是您可以执行的操作的提示.

Since the question is a bit vague on the nature of edits, these are just cues on what you could do.

我不想每次更改都重新更改密码.

I don't want to have to change every commit to reword.

您可以将git-rebase -i所使用的编辑器更改为git config sequence.editor 'sed -i s/pick/reword/',这样就不会弹出针对rebase-todo的编辑器,并且可以替换选择.但这有点笨拙,因为您必须在之后取消配置. (对于其他情况,还有core.editor,还有$EDITOR).

You could change the editor used by git-rebase -i with git config sequence.editor 'sed -i s/pick/reword/', so that no editor pops for the rebase-todo, and picks are replaced. But that's a bit clumsy because you have to cancel the config after. (there's also core.editor for other cases, and $EDITOR).

您也可以运行git rebase origin/master -x 'git commit --amend'. -x在rebase-todo中的每个pick之后添加exec <argument of the -x>行.请注意,这里不需要-i.该修改将允许您更改提交消息,例如git commit --amend -m "new message".

You can also run git rebase origin/master -x 'git commit --amend'. -x adds a exec <argument of the -x>, line after each pick in the rebase-todo. Note there's no -i needed here. The amend will allow you to change the commit message, for example git commit --amend -m "new message".

我不想手动输入每次我想改写信息的提交.

I don't want to manually type in every commit I want to reword the message of.

您可以对非交互式命令使用EDITOR变量,该命令以您想要的方式进行编辑,但是我不知道您想进行哪种编辑.

You can use the EDITOR variable to a non-interactive command that edits in the way you want, but I don't know which kind of editing you want to do.

我想用pick以外的其他东西重新建立所有新提交

I want to rebase all the new commits with something other than pick

查看以前的答案.

这篇关于自动重新措词所有重新提交的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆