문제

The git cherry command is great for seeing what commits have happened between two branches. However, by default it just gives you a list of commit IDs - not that informative.

$ git cherry master dev # Commits in "dev" since it forked from "master"
+ 54408ddc6403376c638d5bfc94c033ab655da7b3
+ 68bc4277954b7de4c95881904de22f1d443366ae
+ d74ab86eee75a8e5c1a835a6e69e74c01d4186e8

How can I get the same list with more information?

도움이 되었습니까?

해결책 2

You can use git cherry -v master dev

It will show commit message with commit hash.

다른 팁

You can achieve this by piping git cherry output through two more commands:

First use sed to remove the + at the start of each line to leave the raw commit IDs:

$ git cherry master dev | sed 's/^+ //'
54408ddc6403376c638d5bfc94c033ab655da7b3
68bc4277954b7de4c95881904de22f1d443366ae
d74ab86eee75a8e5c1a835a6e69e74c01d4186e8

Now use xargs --max-lines=1 to pass each commit ID to git log -1, which can then display other information about each commit:

$ git cherry master dev | sed 's/^+ //' | xargs --max-lines=1 git log -1 --pretty=format:"%h [%ad] %an : %s" --date=short
54408dd [2013-10-09] Robin Winslow : Update Binaries submodule
68bc427 [2013-10-09] Robin Winslow : Update reference dependencies for Website
d74ab86 [2013-10-09] Robin Winslow : Remove non-exisent files from Website project

Note: You can tailor the --pretty=format:"%h [%ad] %an : %s" --date=short part to get whatever output you like from git log

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top