Main Content

pull

Download and merge new data from remote Git repository into local repository

Since R2023b

    Description

    pull(repo) downloads new data from the remote Git™ repository repo that the current branch tracks. The pull function attempts to automatically merge all pulled commits into the currently checked-out branch in your local repository. If the merge results in file conflicts, the pull function reports that the merge is incomplete. To complete the merge, resolve and commit the conflicted files.

    example

    pull(repo,Name=Value) specifies additional options as one or more name-value arguments.

    example

    Examples

    collapse all

    Navigate to your repository folder and create a repository object.

    repo = gitrepo;

    Pull new data from the remote Git repository that the current branch tracks.

    pull(repo);
    

    Navigate to your repository folder and create a repository object.

    repo = gitrepo;

    Pull new data from a passphrase-protected remote repository.

    secrets = loadenv("github.env");
    pull(repo,Username=secrets("GITHUB_USER"),Token=secrets("GITHUB_TOKEN"));
    

    To prevent frequent login prompts when you interact with your remote repository using HTTPS, configure a Git credential manager to remember credentials. For more information, see Manage Git Credentials.

    Input Arguments

    collapse all

    Git repository, specified as a matlab.git.GitRepository object.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: pull(repo,Username="myusername",Token="mypersonaltoken")

    Username for the Git repository account, specified as a character vector or string scalar.

    Data Types: char | string

    Personal access token for the Git repository account, specified as a character vector or string scalar.

    Data Types: char | string

    Version History

    Introduced in R2023b