MATLAB 帮助中心
切换 Git 分支
自 R2023b 起
branchDetails = switchBranch(repo,name)
branchDetails = switchBranch(repo,name) 切换到 Git™ 存储库 repo 中指定的本地分支 name。
branchDetails
repo
name
示例
全部折叠
导航到您的存储库文件夹并创建一个存储库对象。
repo = gitrepo;
切换到 FeatureB 分支。
FeatureB
branchDetails = switchBranch(repo,"FeatureB");
branchDetails = GitBranch with properties: Name: "FeatureB" LastCommit: [1×1 GitCommit] (1376b77)
提示
使用 Tab 键自动填充功能获取存储库中可用本地分支的列表。
matlab.git.GitRepository
Git 存储库,指定为 matlab.git.GitRepository 对象。
matlab.git.GitBranch
本地分支的名称,指定为字符串标量或字符向量。
示例: "BugIssue1032", 'FeatureB'
"BugIssue1032"
'FeatureB'
数据类型: char | string
char
string
分支的详细信息,以 matlab.git.GitBranch 对象形式返回。
在 R2023b 中推出
gitclone | gitrepo | commit | createBranch
gitclone
gitrepo
commit
createBranch
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 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处