Git 예쁜 형식 색상
Git에 예쁜 형식 색상을 설정하려고합니다. 버전 1.6.0은 빨강, 초록, 파랑 만 인식합니다.
$ git log --pretty=format:"%Credred%Creset %Cgreengreen%Creset %Cyellowyellow%Creset %Cblueblue%Creset %Cmagentamagenta%Creset %Ccyancyan%Creset %Cwhitewhite%Creset"
red green %Cyellowyellow%Creset blue %Cmagentamagenta %Ccyancyan %Cwhitewhite
또한 어떤 색상도 괄호로 묶인 색상 형식으로 작동하지 않습니다.
Git에 사용 가능한 예쁜 형식 색상을 나열하는 방법이 있습니까?
불행히도 이것은 레거시 SCO OpenServer 5.0.7 시스템에 있으며 SCO Skunkworks에서 출시 한 Git의 마지막 버전은 1.6.0.3입니다.
나는 이전 버전이 없습니다 git
이외의 색상을 확인하는 red
, blue
그리고이 green
지원됩니다.
한 가지 내가 심지어의 최신 버전으로 발견,하지만 git
(내가 사용 1.7.10 같은)보다 다른 색상입니다 red
, green
그리고 blue
괄호 안에해야합니다 ()
. 를 들어 red
, green
와 blue
, 괄호는 선택 사항입니다.
그래서 이것을 시도해보십시오.
git log --pretty=format:"%Credred%Creset %Cgreengreen%Creset %C(Yellow)yellow%Creset %Cblueblue%Creset %C(magenta)magenta%Creset %C(cyan)cyan%Creset %C(white)white%Creset"
내가 적어도 알고있는 색상 목록은 다음과 같습니다.
normal
black
red
green
yellow
blue
magenta
cyan
white
다음 속성 중 하나와 결합 할 수 있습니다.
bold
dim
ul
blink
reverse
를 사용하여 색상을 변경하려는 경우 전경색 과 배경색의.gitconfig
두 가지 색상을 지정할 수 있어야 하며 속성과 결합 할 수 있습니다.
Git 2.3.0 (2015 년 2 월)에서는 다음을 허용합니다 ( Jeff Kink ( peff
) 덕분에 ).
- 24 비트 RGB 색상 값 ( 커밋 17a4be2 )
parse_color
: 24 비트 RGB 값 지원XTerm과 같은 일부 터미널은 일반 ANSI 색 구성표의 확장을 사용하여 전체 24 비트 RGB 색 사양을 허용합니다.
사용자가 16 진수 RGB 색상을 지정 하여 핫 핑크 참조 장식의 가장 중요한 기능을 활성화 할 수 있습니다 .
git log --format="%h%C(#ff69b4)%d%C(reset) %s"
- 더 나은 색상 속성 관리 :
parse_color
: 속성no$foo
을 지우려면 " " 인식$foo
색상 사양에 "reverse"를 입력하여 "reverse"와 같은 ANSI 텍스트 속성을 켤 수 있습니다. 그러나 리버스 해제를 요청할 수는 없습니다.
일반적인 경우에는 중요하지 않습니다. 컬러 섹션의 시작 부분에서 "역방향"을 설정 한 다음 "재설정"을 사용하여 모든 속성을 지 웁니다.
그러나 일부 속성을 설정 한 다음 선택적으로 다른 속성을 비활성화 할 수 있습니다. 예를 들면 :
git log --format="%C(bold ul yellow)%h%C(noul) %s"
해시에만 밑줄을 긋지 만 나머지 속성을 다시 지정할 필요는 없습니다.
이는
contrib/diff-highlight
기존 색상을 방해하지 않고 일부 속성을 켜거나 끄려는와 같은 타사 프로그램에도 도움이 될 수 있습니다 .일부 속성 사양은 의미가 없을 수 있습니다 (예 : "
bold nobold
"). 우리는 그러한 구조에 플래그를 지정하지 않고 대신 터미널이 그것을 분류하도록합니다.
내 자식 로그 형식 공유 :
$ git log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit
~ / .gitconfig에 별칭을 추가 할 수도 있습니다 .
[alias]
logs = log --graph --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) %C(cyan)<%an>%Creset' --abbrev-commit
그런 다음에서 정의한대로 별칭을 사용할 수 있습니다 ~/.gitconfig
.
$ git logs
저는 Ubuntu 18.04를 사용하고 있으며 Xiaofei HAN의 제안을 사용할 수있었습니다.
이것을 완료하려는 초보자에게는 .gitconfig를 편집하여 행운을 빕니다.
nano ~/.gitconfig
기존 텍스트 아래에서 위의 [별칭] 블록 붙여 넣기
CTRL + O (쓰기) + CTRL + X (나노 닫기)
이렇게하면 예쁜 색이 보이려면
git logs
사용
'git log'는 색상없이보기를 제공합니다.
'git logs --oneline'과 동일하지만 측면에 번창이 표시된다는 점만 제외하면
thank you, i hope this helps someone
Here are two aliases that I wrote once I understood the syntax of using custom hexadecimal color values as shown in @VonC 's answer.
There are four versions, the only difference is the --graph directive and the 'f' versions will also show you files that were added, deleted or modified:
[alias]
lg = log --graph --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s"
l1 = log --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s"
lgf = log --name-status --graph --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s"
l1f = log --name-status --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)\\ %d\\%C(#c0d6de)%s"
I used this site to pick the exact colors I wanted and then copied the hex value from it:
For Windows, open up your .gitconfig file that resides in your "C:\Users\YourUserName" Folder and add an alias section as depicted above.
Hope you like them.
참고URL : https://stackoverflow.com/questions/15458237/git-pretty-format-colors
'Program Tip' 카테고리의 다른 글
HTML에서 입력 및 텍스트 입력 선택-동일한 너비를 만드는 가장 좋은 방법은 무엇입니까? (0) | 2020.10.23 |
---|---|
codeigniter 이메일 라이브러리를 사용하여 Gmail SMTP로 이메일 보내기 (0) | 2020.10.23 |
Linux에서 특정 시간에 스크립트를 실행하는 방법은 무엇입니까? (0) | 2020.10.23 |
Java 8 스트림을 Guava ImmutableCollection으로 수집하려면 어떻게해야합니까? (0) | 2020.10.23 |
.NET Core에서 데스크톱 GUI 응용 프로그램을 만들 수 있습니까? (0) | 2020.10.23 |