Main Content

status

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

Since R2023b

    Description

    statusDetails = status(repo) returns the status of files in the working folder and the staging area in the Git™ repository repo.

    example

    statusDetails = status(repo,Files=listOfFiles) returns only the status of the specified files.

    example

    statusDetails = status(repo,Name=Value) specifies additional options as one or more name-value arguments.

    example

    Examples

    collapse all

    Navigate to your repository folder and create a repository object.

    repo = gitrepo;

    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.

    repo = gitrepo;

    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.

    repo = gitrepo;

    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

    Git repository, specified as a matlab.git.GitRepository object.

    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

    Specify optional pairs of arguments as Name1=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