status - Display status of files in working folder and staging area in Git repository - MATLAB (original) (raw)

Main Content

Display status of files in working folder and staging area in Git repository

Since R2023b

Syntax

Description

[statusDetails](#mw%5Fd32419a7-b997-4b8a-89f5-c691d6fa9787) = status([repo](#mw%5Fae95609f-43b0-4082-bc18-8d83a48bf2c2)) returns the status of files in the working folder and the staging area in the Git™ repository repo.

example

[statusDetails](#mw%5Fd32419a7-b997-4b8a-89f5-c691d6fa9787) = status([repo](#mw%5Fae95609f-43b0-4082-bc18-8d83a48bf2c2),Files=[listOfFiles](#mw%5F1b646f37-d699-4db8-a752-c700d7afc86f)) returns only the status of the specified files.

example

[statusDetails](#mw%5Fd32419a7-b997-4b8a-89f5-c691d6fa9787) = status([repo](#mw%5Fae95609f-43b0-4082-bc18-8d83a48bf2c2),[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 status of the working folder and the staging area. The output shows no modified files and one untracked file.

statusDetails = status(repo)

statusDetails =

1×1 table

                                                      Status        
                                                _____________________

"C:\myWorkSpace\examples\myproject\newfile.m"    NotUnderSourceControl

Add and commit the file to source control.

add(repo,"newfile.m"); commit(repo,message="Add file");

Display the status of the working folder and the staging area. The output shows no modified or untracked files to commit.

statusDetails = status(repo)

statusDetails = 0×1 empty table

Navigate to your repository folder and create a repository object.

Display the status of specific files in the repository folder. The output shows no modified or untracked files to commit.

statusDetails = status(repo,Files=["data.txt","lib\timesthree.mexw64"])

statusDetails =

2×1 table

                                                              Status  
                                                             __________

"C:\myWorkSpace\examples\myproject\data.txt"                 Unmodified
"C:\myWorkSpace\examples\myproject\lib\timesthree.mexw64"    Ignored  

Navigate to your repository folder and create a repository object.

Display the status of files in the repository, including ignored files. The output shows no modified or untracked files to commit. The repository has two ignored files or folders.

statusDetails = status(repo,IncludeIgnoredFiles=true)

statusDetails =

2×1 table

                                                             Status 
                                                             _______

"C:\myWorkSpace\examples\myproject\lib\timesthree.mexw64"    Ignored
"C:\myWorkSpace\examples\myproject\work"                     Ignored 

Input Arguments

collapse all

Files to query, specified as a string array, character vector, or cell array of character vectors. If you do not specify this input, the function displays the status for all the files in the repository.

Example: "newfile.m"

Data Types: char | string | cell

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: status(repo,IncludeUntrackedFiles=true)

Option to display the status for untracked files in the Git repository, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Option to display the status for ignored files in the Git repository, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Option to display the status for unmodified files in the Git repository, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Output Arguments

collapse all

Status of the files in the working folder and the stage area in the Git repository, returned as a table.

Version History

Introduced in R2023b