`git rebase -i` 在编辑器中显示 ansi 颜色代码
`git rebase -i` shows ansi colour codes in editor
当我 运行 git rebase -i
时,我在常规待办事项列表(任何 repos,任何编辑器)之后显示 ansi 颜色代码,它们来自哪里?
- git 版本,尝试了 2.13 和 2.15,我修改了我的用户设置以测试
color.ui
& color.interactive
是错误的。
- 在git配置(
core.editor
)中尝试了vim、nano、subl和ed
,都有这个问题
谢谢。
pick 5c0cbe059d56e2fe2bac4bf9e3373d5882157f4a commit
[38;5;252m# Rebase b4c6863..5c0cbe0 onto b4c6863 (1 command)[39m
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
好的,我设法解决了这个问题,这是因为我在 $PATH
中创建了一个自定义 cat
,其内容是:
#!/bin/bash
if [[ ! -f $(which pygmentize) ]] ; then
# if pygmentize not installed, use raw cat
/bin/cat $@
else
# pip install --user Pygments
# html output: pygmentize -f html -O full,style=vim
pygmentize -O style=native -f console256 -g $@;
fi
基本上它使用 pygmentize
语法高亮,我猜 git
正在使用 cat
生成变基待办事项列表,因此我的自定义 cat
污染了 git输出。
要解决此问题,只需将自定义 cat
重命名为其他名称即可。
当我 运行 git rebase -i
时,我在常规待办事项列表(任何 repos,任何编辑器)之后显示 ansi 颜色代码,它们来自哪里?
- git 版本,尝试了 2.13 和 2.15,我修改了我的用户设置以测试
color.ui
&color.interactive
是错误的。- 在git配置(
core.editor
)中尝试了vim、nano、subl和ed
,都有这个问题
谢谢。
pick 5c0cbe059d56e2fe2bac4bf9e3373d5882157f4a commit
[38;5;252m# Rebase b4c6863..5c0cbe0 onto b4c6863 (1 command)[39m
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
好的,我设法解决了这个问题,这是因为我在 $PATH
中创建了一个自定义 cat
,其内容是:
#!/bin/bash
if [[ ! -f $(which pygmentize) ]] ; then
# if pygmentize not installed, use raw cat
/bin/cat $@
else
# pip install --user Pygments
# html output: pygmentize -f html -O full,style=vim
pygmentize -O style=native -f console256 -g $@;
fi
基本上它使用 pygmentize
语法高亮,我猜 git
正在使用 cat
生成变基待办事项列表,因此我的自定义 cat
污染了 git输出。
要解决此问题,只需将自定义 cat
重命名为其他名称即可。