
나는 다음 명령을 가지고 있습니다 :
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs"
컬러 출력을 제공하지만 파이프하면 git stash list <..> | less -R
출력에서 색상이 사라집니다.
git stash list
비아 튜브의 색상을 유지하는 방법은 무엇입니까 ?
답변1
git은 사용자가 무엇을 파이프하고 있는지 알지 못하기 때문에 이것은 기능입니다.
다음과 같이 항상 색상을 출력하도록 명령을 구성할 수 있습니다.
git -c color.ui=always your command | less -R
렌짓:
-c <name>=<value> Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots).
또 다른 옵션은 다음을 구성하는 것입니다 core.pager
.
git config core.pager "less -R"
따라서 스스로 파이프를 연결할 필요가 없습니다 less
.
답변2
올바른 명령은 다음과 같아야 합니다.
git stash list --color=always --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs"
옵션 추가--color=always