--- layout: default menu_item: api title: AnnotatedCommit description: Version 0.26.1 menu_item: api return_to: "API Documentation Index": /api/ sections: "fromFetchhead": "#fromFetchhead" "fromRef": "#fromRef" "fromRevspec": "#fromRevspec" "lookup": "#lookup" "#id": "#id" "#ref": "#ref" --- ## AnnotatedCommit.fromFetchhead Async ```js AnnotatedCommit.fromFetchhead(repo, branch_name, remote_url, id).then(function(annotatedCommit) { // Use annotatedCommit }); ``` | Parameters | Type | | | --- | --- | --- | | repo | [Repository](/api/repository/) | repository that contains the given commit | | branch_name | String | name of the (remote) branch | | remote_url | String | url of the remote | | id | [Oid](/api/oid/) | the commit object id of the remote branch | | Returns | | | --- | --- | | [AnnotatedCommit](/api/annotated_commit/) | | ## AnnotatedCommit.fromRef Async ```js AnnotatedCommit.fromRef(repo, ref).then(function(annotatedCommit) { // Use annotatedCommit }); ``` | Parameters | Type | | | --- | --- | --- | | repo | [Repository](/api/repository/) | repository that contains the given reference | | ref | [Reference](/api/reference/) | reference to use to lookup the git_annotated_commit | | Returns | | | --- | --- | | [AnnotatedCommit](/api/annotated_commit/) | | ## AnnotatedCommit.fromRevspec Async ```js AnnotatedCommit.fromRevspec(repo, revspec).then(function(annotatedCommit) { // Use annotatedCommit }); ``` | Parameters | Type | | | --- | --- | --- | | repo | [Repository](/api/repository/) | repository that contains the given commit | | revspec | String | the extended sha syntax string to use to lookup the commit | | Returns | | | --- | --- | | [AnnotatedCommit](/api/annotated_commit/) | | ## AnnotatedCommit.lookup Async ```js AnnotatedCommit.lookup(repo, id).then(function(annotatedCommit) { // Use annotatedCommit }); ``` | Parameters | Type | | | --- | --- | --- | | repo | [Repository](/api/repository/) | repository that contains the given commit | | id | [Oid](/api/oid/) | the commit object id to lookup | | Returns | | | --- | --- | | [AnnotatedCommit](/api/annotated_commit/) | | ## AnnotatedCommit#id Sync ```js var oid = annotatedCommit.id(); ``` | Returns | | | --- | --- | | [Oid](/api/oid/) | commit id | ## AnnotatedCommit#ref Sync ```js var string = annotatedCommit.ref(); ``` | Returns | | | --- | --- | | String | ref name. |