How to get parent of specific commit in Git?

前端 未结 8 1247
别跟我提以往
别跟我提以往 2021-02-02 06:25

I have commit number. I would like to get previous commit number(parent). I need commits from current branch.

8条回答
  •  庸人自扰
    2021-02-02 06:43

    To get the parent, just add a ^ after the commit SHA of the commit you want to see.

    To see a commit: git show Example: git show bb05425c504575145d005c0a887e0a80b885ced0

    To see the parent: git show ^
    Example: git show bb05425c504575145d005c0a887e0a80b885ced0^

提交回复
热议问题