是否可以有一个小的 shell 脚本来替换$EDTIOR
for git 和 svn?
因此,当不熟悉 vi 或 emacs 的人进行提交并忘记添加
-m "fixed the foo bug"
参数时,它不会打开编辑器,他们不知道如何退出,而是只会提示
请证明此提交包含的内容:
用户只需写一个小句子,按回车键,然后就关闭了。
是否可以有一个小的 shell 脚本来替换$EDTIOR
for git 和 svn?
因此,当不熟悉 vi 或 emacs 的人进行提交并忘记添加
-m "fixed the foo bug"
参数时,它不会打开编辑器,他们不知道如何退出,而是只会提示
请证明此提交包含的内容:
用户只需写一个小句子,按回车键,然后就关闭了。
对于 git,您可以编辑您的config
文件。添加editor
到core
部分,并指向您选择的编辑器。比如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 "$*"`
我们有一个理由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