如何将gedit配置为git core.editor?

时间:2013-10-18 17:45:02

标签: git gedit

我已将gedit配置为git core.editor。

git config --global core.editor "gedit"

除非已打开gedit窗口,否则此工作正常。在这种情况下,COMMIT_EDITMSG在现有窗口中打开,gedit立即返回。 Git以空提交消息结束并失败。

此网站(http://fabianschuiki.wordpress.com/2012/05/20/use-gedit-as-git-editor/)建议使用“gedit -s -w”,但我没有这些选项(并且--new-window不起作用):

$ gedit -V
gedit - Version 2.28.4

$ gedit --help
Usage:
  gedit [OPTION...] [FILE...] - Edit text files

Help Options:
  -h, --help                      Show help options
  --help-all                      Show all help options
  --help-gtk                      Show GTK+ Options
  --help-sm-client                Show session management options

Application Options:
  -V, --version                   Show the application's version
  --encoding=ENCODING             Set the character encoding to be used to open the files listed on the command line
  --list-encodings                Display list of possible values for the encoding option
  --new-window                    Create a new toplevel window in an existing instance of gedit
  --new-document                  Create a new document in an existing instance of gedit
  --display=DISPLAY               X display to use

3 个答案:

答案 0 :(得分:21)

解决此问题的最简单方法是升级gedit(使用Ubuntu 13.10时为3.8.3)

在3.x中,-s(独立)和-w(等待)可用 这允许(commentedFortisimo):

git config --global core.editor "gedit -w -s" 

作为Gábor Lipták评论below,这适用于gedit3,其安装时为:

sudo apt-get install gedit-common/trusty 
sudo apt-get install gedit/trusty

(在Linux Mint上)

答案 1 :(得分:18)

所有归功于VonC的答案,但-w使我的ubuntu 16.04上的gedit(3.18)崩溃。尽管如此,工作正常:

git config --global core.editor "gedit -s"

答案 2 :(得分:0)

感兴趣的朋友: 在 ubuntu 18 gedit 下使用 -w 在段错误下崩溃

enter image description here

但是 -s 很好用

所以请这样做:

<块引用>

git config --global core.editor "gedit -s"

相关问题