git rebase --editor = /某物/其他/ than / vim? (以便于挤压) [英] git rebase --editor=/something/other/than/vim? (for easier squashing)

查看:86
本文介绍了git rebase --editor = /某物/其他/ than / vim? (以便于挤压)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴将vim用作提交的默认编辑器,并且不想更改它。但是,当涉及到基础调整时,我发现自己压缩了数十个提交,而使用诸如Textwrangler之类的交互式编辑器(用 pick替换为 squash,除了最上面的提交以外的所有内容),我发现要轻松得多。

I happily use vim as my default editor for commits, and do not wish to change it. However, when it comes to rebasing, I find myself squashing dozens and dozens of commits which I find much easier with an interactive editor like Textwrangler (substituting "pick" with "squash" in all but the top commit).

是否可以为一次性rebase命令指定替代编辑器?

I在vim中知道我可以做到:

I know in vim I can do:

:%s/pick/squash/

,但这有其自身的小问题。

but that has its own minor annoyances.

编辑-如评论中所述,您可以通过第二行并执行

EDIT - as stated in the comments, you can squash all but the top commit very efficiently by going to the 2nd line and executing

:,$s/pick/squash/

(请注意逗号和美元与原始字符不同)

(note the comma and dollar are different to the original)

推荐答案

尝试在命令前添加 GIT_EDITOR 环境变量,如下所示:

Try adding the GIT_EDITOR environment variable before your command, like so:

GIT_EDITOR=<editor of choice> git rebase <...>

例如,使用 nano 类型:

GIT_EDITOR=nano git rebase -i abcdef1234

这篇关于git rebase --editor = /某物/其他/ than / vim? (以便于挤压)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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