MATLAB 帮助中心
将新文件标记为要添加到 Git 存储库
自 R2023b 起
add(repo,files)
add(repo,files) 将文件 files 标记为要添加到 Git™ 存储库 repo 中。
repo
files
示例
全部折叠
创建一个新的 Git 存储库和一个存储库对象。
repo = gitinit("newrepo");
创建一个新脚本。
edit newScript.m;
将该脚本文件标记为要添加到存储库。
add(repo,"newScript.m");
将新文件提交到存储库。
commitDetails = commit(repo,message="Add file")
commitDetails = GitCommit with properties: Message: "Add File" ID: "c205f677db61dc94cc5e48a4467410f45e31db4a" AuthorName: "username" AuthorEmail: "username@mathworks.com" AuthorDate: 17-Apr-2023 14:32:10 +0000 CommitterName: "username" CommitterEmail: "username@mathworks.com" CommitterDate: 17-Apr-2023 14:32:10 +0000 ParentCommits: [0×1 string]
matlab.git.GitRepository
Git 存储库,指定为 matlab.git.GitRepository 对象。
要添加到 Git 存储库的文件,指定为字符串数组、字符向量或字符向量元胞数组。
示例: "newfile.m"
"newfile.m"
数据类型: char | string | cell
char
string
cell
在执行合并时,可以使用 add 或 rm 函数将文件上的冲突标记为已解决。
add
rm
在 R2023b 中推出
gitrepo | gitinit | gitclone | rm | commit
gitrepo
gitinit
gitclone
commit
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处