Fetching the latest changes from a remote¶
Fetch all remote changes from a remote repository without integrating (merging) them into the current repository (working directory). Ensures the existing repository only tracks the latest remote changes.
Fetch all changes¶
Calling Fetch
without any options will attempt to retrieve and track all the latest changes from the default remote.
Fetch from all remotes¶
To fetch the latest changes from all tracked remotes, use the WithAll
option.
Fetch and follow tags¶
Retrieve all of the latest tags and track them locally with the WithTags
option.
Fetch but do not follow tags¶
The WithIgnoreTags
option turns off local tracking of tags retrieved from the remote.
Limit fetching of commit history¶
Limit the number of commits fetched from the tip of each remote branch history, using the WithDepthTo
option. This can be used to deepen or shorten the existing history of a shallow cloned repository.
Printing the log results in:
feat: add initial support for git fetch
feat: extend pull options to control how change sets are retrieved
Force fetching into an existing local branch¶
Fetching may be refused if updating a locally tracked branch through the WithFetchRefSpecs
option. Use the WithForce
option to turn off this check.
Providing git config at execution¶
You can provide git config through the WithFetchConfig
option to only take effect during the execution of a Fetch
, removing the need to change config permanently.