git의cat-file 명령 사용법

1673 단어 git

명령 옵션


git cat-file Provide content or type and size information for repository objects. git cat-file 명령은 버전 라이브러리 객체의 내용, 유형 및 크기 정보를 표시합니다.
object
The name of the object to show. For a more complete list of ways to spell object names, see the “SPECIFYING REVISIONS” section in gitrevisions(7).
-t Instead of the content, show the object type identified by object. 객체의 유형을 표시합니다.
-s Instead of the content, show the object size identified by object. 객체의 크기를 표시합니다.
-e Suppress all output; instead exit with zero status if object exists and is a valid object. 객체가 존재하고 유효한 경우 명령 종료 상태 반환 값은 0입니다.
-p
Pretty-print the contents of object based on its type. 대상의 유형에 따라 우아한 방식으로 대상의 내용을 현시한다.
type Typically this matches the real type of object but asking for a type that can trivially be dereferenced from the given object is also permitted. An example is to ask for a “tree” with object being a commit object that contains it, or to ask for a “blob” with object being a tag object that points at it.

사용 예

sha1sum 명령은 문자열 "Git"의 해시 값을 생성합니다.
printf Git | sha1sum

생성HEAD 대상의 하희값:
(printf "%s %d\000" `git cat-file -t HEAD` `git cat-file -s HEAD`; git cat-file -p HEAD) | sha1sum

참고 자료


git-cat-file gitrevisions

좋은 웹페이지 즐겨찾기