Git
Chapters ▾ 2nd Edition

A3.6 附錄 C: Git Commands - Inspection and Comparison

Inspection and Comparison

git show

The git show command can show a Git object in a simple and human readable way. Normally you would use this to show the information about a tag or a commit.

We first use it to show annotated tag information in 有註解的標籤.

Later we use it quite a bit in Revision Selection to show the commits that our various revision selections resolve to.

One of the more interesting things we do with git show is in Manual File Re-merging to extract specific file contents of various stages during a merge conflict.

git shortlog

The git shortlog command is used to summarize the output of git log. It will take many of the same options that the git log command will but instead of listing out all of the commits it will present a summary of the commits grouped by author.

We showed how to use it to create a nice changelog in 簡短的日誌.

git describe

The git describe command is used to take anything that resolves to a commit and produces a string that is somewhat human-readable and will not change. It’s a way to get a description of a commit that is as unambiguous as a commit SHA-1 but more understandable.

We use git describe in 產生一個建置編號 and 準備釋出一個版本 to get a string to name our release file after.

scroll-to-top