【问题标题】:''subl' --wait' doesn't work while merging branch [Git]''subl' --wait' 在合并分支时不起作用 [Git]
【发布时间】:2016-09-14 19:54:37
【问题描述】:

我在Git 2.10 发行说明上关注了几篇关于pretty 属性的文章。通过将 git 升级到 2.10.0 并对全局 .gitconfig 进行更改,结果如下 -

[filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true
[user]
    name = xyz
    email = abc.def@gmail.com
    signingkey = AAAAAAA
[core]
    excludesfile = /Users/xyz/.gitignore_global
    editor = 'subl' --wait   <!--this is where its failing I guess--!>
[difftool "sourcetree"]
    cmd = opendiff \"$LOCAL\" \"$REMOTE\"
    path = 
[mergetool "sourcetree"]
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
    trustExitCode = true
[alias]
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[color "diff"]
    old = red strike
    new = green italic

但是现在当我尝试执行如下 git 命令时,我在控制台或正确的消息显示上没有任何进度详细信息。

➜  automation git:(branch1) git pull origin master
From https://github.com/XYZ/automation
 * branch            master     -> FETCH_HEAD
Auto-merging pom.xml
Auto-merging test/pom.xml
'subl' --wait: subl: command not found
error: There was a problem with the editor ''subl' --wait'.
Not committing merge; use 'git commit' to complete the merge.

更新:发布来自 @Arvin 的评论以防止重复

如果我按照那里的解决方案使用

更改我的默认 git 编辑器
git config --global core.editor "subl -n -w"

我还是明白了

subl -n -w: subl: command not found error: There was a problem with 编辑器'subl -n -w'。

【问题讨论】:

标签: git macos github git-merge


【解决方案1】:

这篇文章应该会有所帮助 - How can I make Sublime Text the default editor for Git?

下面是它所说的-

崇高文本 2(内部版本 2181)

最新的build 2181 刚刚添加了对-w(等待)命令行参数的支持。以下配置将允许 ST2 作为 Windows 上的默认 git 编辑器工作。这将允许 git 打开 ST2 以获取提交消息等。

git config --global core.editor "'c:/program files/sublime text 2/sublime_text.exe' -w"

崇高文本 3(构建 3065)

Sublime Text 3 (Build 3065) 添加了subl.exe 命令行助手。使用subl.exe -h 获取您可用的选项。我在 Sublime Text 用户设置中设置了 hot_exit: true 和 remember_open_files: true。我发现以下 git config 对我很有效。

git config --global core.editor "'c:/program files/sublime text 3/subl.exe' -w"

有了这个 git config,我的编辑器中就会打开一个新选项卡。我编辑我的提交消息,保存选项卡并关闭它 (CTRL+w)。 Git 将等到选项卡关闭后才能继续工作。

【讨论】:

  • 在您发表评论后更新了问题和标签(osx)。这似乎也没有解决问题。
猜你喜欢
  • 2018-09-16
  • 2023-03-06
  • 1970-01-01
  • 2018-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-09
相关资源
最近更新 更多