Find commit by hash SHA in Git

前端 未结 3 1947
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 18:30

I need to find a commit in Git by a given hash, SHA. For example, if I have the \"a2c25061\" hash, and I need to get the author and the committer of this commit.

What i

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 18:48

    git log -1 --format="%an %ae%n%cn %ce" a2c25061
    

    The Pretty Formats section of the git show documentation contains

    • format:

    The format: format allows you to specify which information you want to show. It works a little bit like printf format, with the notable exception that you get a newline with %n instead of \n

    The placeholders are:

    • %an: author name
    • %ae: author email
    • %cn: committer name
    • %ce: committer email

提交回复
热议问题