zl程序教程

您现在的位置是:首页 >  工具

当前栏目

How to get parent of specific commit in Git?

Git to in of get How commit Parent
2023-09-11 14:14:17 时间

How to get parent of specific commit in Git?

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

回答

To get Parent Commit

git cat-file -p commit_id

tree tree_id
parent parent_commit_id
[parent other_parent_commit_id] # present only in case of merge commits
author xxx <xxx@email.com> 1513768542 +0530
committer xxx <xxx@email.com> 1513768542 +0530