status
Display status of files in working folder and staging area in Git repository
Since R2023b
Syntax
Description
returns the status of files in the working folder and the staging area in the Git™ repository statusDetails
= status(repo
)repo
.
returns only the status of the specified files.statusDetails
= status(repo
,Files=listOfFiles
)
specifies additional options as one or more name-value arguments.statusDetails
= status(repo
,Name=Value
)
Examples
Display Status of Working Folder and Staging Area
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
Display Status of Specified Files
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
Display Status of Working Folder Including Ignored Files
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
repo
— Git repository
matlab.git.GitRepository
object
Git repository, specified as a matlab.git.GitRepository
object.
listOfFiles
— Files to query
string array | character vector | cell array of character vectors
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)
IncludeUntrackedFiles
— Option to display status for untracked files
true
or 1
(default) | false
or 0
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
IncludeIgnoredFiles
— Option to display status for ignored files
false
or 0
(default) | true
or 1
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
IncludeUnmodifiedFiles
— Option to display status for unmodified files
false
or 0
(default) | true
or 1
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
statusDetails
— Status of files in working folder and stage area
table
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
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)