![Git: 파이프 --pretty=<..>를 통해 git stash 목록의 색상을 유지합니다.](https://linux55.com/image/142971/Git%3A%20%ED%8C%8C%EC%9D%B4%ED%94%84%20--pretty%3D%26lt%3B..%26gt%3B%EB%A5%BC%20%ED%86%B5%ED%95%B4%20git%20stash%20%EB%AA%A9%EB%A1%9D%EC%9D%98%20%EC%83%89%EC%83%81%EC%9D%84%20%EC%9C%A0%EC%A7%80%ED%95%A9%EB%8B%88%EB%8B%A4..png)
나는 다음 명령을 가지고 있습니다 :
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