switchBranch - Switch Git branch - MATLAB (original) (raw)
Main Content
Switch Git branch
Since R2023b
Syntax
Description
[branchDetails](#mw%5Fdefe7bfa-6d74-4c76-b937-500210389ef2) = switchBranch([repo](#mw%5F4c907829-947d-4f0c-a3f9-a17e7185a7c6),[name](#mw%5F137aa6ad-e427-4fc0-8e95-e41041648bcb))
switches to the specified local branch name
in the Git™ repository repo
.
Examples
Navigate to your repository folder and create a repository object.
Switch to the FeatureB
branch.
branchDetails = switchBranch(repo,"FeatureB");
branchDetails =
GitBranch with properties:
Name: "FeatureB"
LastCommit: [1×1 GitCommit] (1376b77)
Tip
Use tab completion to get the list of available local branches in your repository.
Input Arguments
Name of the local branch, specified as a string scalar or a character vector.
Example: "BugIssue1032"
,'FeatureB'
Data Types: char
| string
Output Arguments
Details of the branch, returned as a matlab.git.GitBranch
object.
Version History
Introduced in R2023b