saveFileRevision - Save revision of file to disk - MATLAB (original) (raw)
Main Content
Save revision of file to disk
Since R2025a
Syntax
Description
saveFileRevision([repo](#mw%5Ff21a3e4f-7793-4695-9165-782a886e6b1a),[filename](#mw%5F71859e11-a8dd-489e-8298-0740063972fa),[fileDestination](#mw%5Fa5d0bcd2-f8cb-457e-a9b5-99b4c8da709f),[commitID](#mw%5F4a76eb85-f5b5-4078-8df7-793728753ea3))
saves the revision commitID
of filename
tofileDestination
on disk in the Gitâ„¢ repository repo
.
Examples
Navigate to your repository folder and create a repository object.
Save the revision 40eba76
of the data.txt
file to disk.
file = fullfile(repo.WorkingFolder,"data.txt"); ancestor = fullfile(repo.WorkingFolder,"data_ancestor.txt"); saveFileRevision(repo,file,ancestor,"40eba76");
Compare the data.txt
file to revision40eba76
.
Input Arguments
Name or path of the file to save, specified as a string scalar or a character vector.
Specify a full path or a path relative to the current folder.
Example: "myfile.slx"
,"../myfile.txt"
Data Types: char
| string
File destination, specified as a string scalar or a character vector.
Specify a full path or a path relative to the current folder.
Example: "file_id08a4c49.slx"
,"../myfile_ancestor.txt"
Data Types: char
| string
Revision specifier (ID), specified as a string scalar, character vector, ormatlab.git.GitBranch
object. If you do not specify this input, the function saves the HEAD
revision of the file.
Commit IDs support short, full, and relative commits.
Example: "08a4c49"
,"08a4c49d249a4dc3d998b473cdda186f1c05dfd0"
,"origin/Dev"
Data Types: char
| string
Version History
Introduced in R2025a