メインコンテンツ

gitrepo

Git リポジトリ オブジェクトの作成

R2023b 以降

    説明

    repo = gitrepo は、現在の作業フォルダーにある Git™ リポジトリ用の matlab.git.GitRepository オブジェクト repo を作成します。repo を使用して、リポジトリをプログラムで操作できます。

    repo = gitrepo(folder) は、指定した folder にある Git リポジトリ用の matlab.git.GitRepository オブジェクト repo を作成します。

    すべて折りたたむ

    Times Table App プロジェクト リポジトリを開き、リポジトリ オブジェクトを作成します。

    openExample("matlab/TimesTableProjectExample")
    repo = gitrepo
    repo = 
    
      GitRepository with properties:
    
        WorkingFolder: "C:\myWorkSpace\examples\TimesTableProjectExample"
            GitFolder: "C:\myWorkSpace\examples\TimesTableProjectExample\.git"
        CurrentBranch: [1×1 GitBranch]  (main)
           LastCommit: [1×1 GitCommit]  (566d916)
              Remotes: [1×1 GitRemote]
        ModifiedFiles: [0×1 string]
       UntrackedFiles: [1×1 string]
               IsBare: 0
            IsShallow: 0
           IsDetached: 0
           IsWorktree: 0 

    指定したフォルダー用にリポジトリ オブジェクトを作成します。

    repo = gitrepo("newrepo\")
    repo = 
    
      GitRepository with properties:
    
         WorkingFolder: "C:\workSpace\newrepo"
             GitFolder: "C:\workSpace\newrepo\.git"
         CurrentBranch: [0×0 GitBranch]
            LastCommit: [0×0 GitCommit]
               Remotes: [1×1 GitRemote] (origin https://github.com/my/repo
         ModifiedFiles: [0×1 string]
        UntrackedFiles: [2×1 string]
                IsBare: 0
             IsShallow: 0
            IsDetached: 0
            IsWorktree: 0

    入力引数

    すべて折りたたむ

    関数が matlab.git.GitRepository オブジェクトを作成するリポジトリ フォルダーのパス。文字ベクトルまたは string スカラーとして指定します。

    出力引数

    すべて折りたたむ

    Git リポジトリ。matlab.git.GitRepository オブジェクトとして返されます。

    バージョン履歴

    R2023b で導入