5

是否可以有一个小的 shell 脚本来替换$EDTIORfor git 和 svn?

因此,当不熟悉 vi 或 emacs 的人进行提交并忘记添加 -m "fixed the foo bug" 参数时,它不会打开编辑器,他们不知道如何退出,而是只会提示

请证明此提交包含的内容:

用户只需写一个小句子,按回车键,然后就关闭了。

4

2 回答 2

2

对于 git,您可以编辑您的config文件。添加editorcore部分,并指向您选择的编辑器。比如cygwin下的notepad++和git:

[core]
    editor = git-core-editor.sh

内容git-core-editor.sh(放入cygwin/bin目录):

#!/bin/sh
"C:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar -nosession `cygpath -w -a "$*"`
于 2011-05-06T06:11:10.423 回答
1

我们有一个理由nano,你知道的。

但是你可以使用一个小的 bash 脚本:

#!/bin/sh
set -e
# Show the message template so the user knows what's up
cat $1
echo "Type your message, or press return to abort:"
head -n1 > $1
于 2011-05-06T06:20:13.917 回答