log - Display record of commits in Git repository - MATLAB (original) (raw)

Main Content

Display record of commits in Git repository

Since R2023b

Syntax

Description

[commitHistory](#mw%5F411465e2-dee4-43bd-8971-c19dbb90a646) = log([repo](#mw%5Ffff3f4a1-cef6-4062-8c4c-b3b5bef44b7c)) returns the record of commits in the Gitâ„¢ repository repo.

example

[commitHistory](#mw%5F411465e2-dee4-43bd-8971-c19dbb90a646) = log([repo](#mw%5Ffff3f4a1-cef6-4062-8c4c-b3b5bef44b7c),[Name=Value](#namevaluepairarguments)) specifies additional options as one or more name-value arguments.

example

Examples

collapse all

Navigate to your repository folder and create a repository object.

Display the commit history for the entire repository.

commitHistory = log(repo);

Navigate to your repository folder and create a repository object.

Display the commit history for a specific file on the current branch in your repository.

commitHistory = log(repo.CurrentBranch,File="utilities\cleanup.m");

Display the commit history up to and including the revision0fb701b.

commitHistory = log(repo.CurrentBranch,File="utilities\cleanup.m",Revisions="0fb701b");

Input Arguments

Name-Value Arguments

collapse all

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: log(repo.CurrentBranch,Revisions="08a4c49")

File to query, specified as a string scalar or character vector. If you do not specify this input, the function returns the commit history for all files.

This input supports files that exist only in the repository history, even if they no longer exist on the local disk.

Example: "newfile.m"

Data Types: char | string

Revision specifiers (ID), specified as a string scalar, a string vector, or a character vector. If you do not specify this input, the function prints the commit history from the first to the most recent commit.

Commit IDs support short, full, and relative commits.

Example: "08a4c49","08a4c49d249a4dc3d998b473cdda186f1c05dfd0","08a4c49^1"

Data Types: char | string

Output Arguments

collapse all

Commit history, returned as a table.

Version History

Introduced in R2023b