isomorphic-git

isomorphic-git

  • API Docs
  • Guide
  • Blog
  • GitHub
  • npm

›Repository

All Commands

  • Alphabetical Index
  • Error Code Index

Repository

  • init
  • clone
  • commit
  • log
  • config
  • fetch
  • checkout
  • push
  • pull
  • merge
  • walkBeta1
  • verify

Files

  • add
  • remove
  • listFiles
  • status

Branches

  • currentBranch
  • branch
  • deleteBranch
  • listBranches

Tags

  • tag
  • annotatedTag
  • deleteTag
  • listTags

Remotes

  • getRemoteInfo
  • addRemote
  • deleteRemote
  • listRemotes

Plugins

  • credentialManager
  • emitter
  • fs
  • http
  • pgp

Plumbing Commands

  • findRoot
  • expandRef
  • expandOid
  • resetIndex
  • resolveRef
  • writeRef
  • deleteRef
  • readObject
  • writeObject
  • statusMatrix
  • isDescendent
  • indexPack

Misc Commands

  • version

Deprecated Commands

  • utils.auth
  • utils.oauth2
  • sign
Edit

fetch

Fetch commits from a remote repository

paramtype [= default]description
fs [deprecated]FSModuleThe filesystem containing the git repo. Overrides the fs provided by the plugin system.
dir, gitdirstring, stringThe working tree directory path, and optionally the git directory path
username, password, token, oauth2formatstring, string, string, stringSee the Authentication documentation
urlstring = undefinedThe URL of the remote repository. Will be gotten from gitconfig if absent.
corsProxystring = undefinedOptional CORS proxy. Overrides value in repo config.
refstring = 'HEAD'Which branch to fetch. By default this is the currently checked out branch.
singleBranchbool = falseInstead of the default behavior of fetching all the branches, only fetch a single branch.
noGitSuffixbool = falseIf true, clone will not auto-append a .git suffix to the url. (AWS CodeCommit needs this option)
remotestring = 'origin'What to name the remote that is created. The default is 'origin'.
depthinteger = undefinedDetermines how much of the git repository's history to retrieve.
sinceDate = undefinedOnly fetch commits created after the given date. Mutually exclusive with depth.
excludeArray<string> = [ ]A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.
relativeboolean = falseChanges the meaning of depth to be measured from the current shallow depth rather than from the branch tip.
tagsboolean = falseAlso fetch tags
headersobject = {}Additional headers to include in HTTP requests, similar to git's extraHeader config
emitter [deprecated]EventEmitter = undefinedOverrides the emitter set via the 'emitter' plugin.
emitterPrefixstring = ''Scope emitted events by prepending emitterPrefix to the event name.
returnPromise<FetchResponse>Resolves successfully when fetch completes

The object returned has the following schema:

export interface FetchResponse {
  defaultBranch: string // The branch that is cloned if no branch is specified (typically "master")
}

Future versions of isomorphic-git might return additional metadata.

To monitor progress events, see the documentation for the 'emitter' plugin.

Example code:

await git.fetch({
  dir: '$input((/))',
  corsProxy: 'https://cors.isomorphic-git.org',
  url: '$input((https://github.com/isomorphic-git/isomorphic-git))',
  ref: '$input((master))',
  depth: $input((1)),
  singleBranch: $input((true)),
  tags: $input((false))
})
console.log('done')
← configcheckout →
isomorphic-git
Docs
Getting StartedAPI Reference
Community
User ShowcaseProject Chat
GitHub
More
In The NewsBlog
Ad