Skip to main content

7.2 Fetching

Also see the git-fetch(1) manpage. For information about the upstream and the push-remote, see The Two Remotes.

f     (magit-fetch)

This transient prefix command binds the following suffix commands along with the appropriate infix arguments and displays them in a temporary buffer until a suffix is invoked.

f p     (magit-fetch-from-pushremote)

This command fetches from the current push-remote.

With a prefix argument or when the push-remote is either not configured or unusable, then let the user first configure the push-remote.

f u     (magit-fetch-from-upstream)

This command fetch from the upstream of the current branch.

If the upstream is configured for the current branch and names an existing remote, then use that. Otherwise try to use another remote: If only a single remote is configured, then use that. Otherwise if a remote named "origin" exists, then use that.

If no remote can be determined, then this command is not available from the magit-fetch transient prefix and invoking it directly results in an error.

f e     (magit-fetch-other)

This command fetch from a repository read from the minibuffer.

f o     (magit-fetch-branch)

This command fetches a branch from a remote, both of which are read from the minibuffer.

f r     (magit-fetch-refspec)

This command fetches from a remote using an explicit refspec, both of which are read from the minibuffer.

f a     (magit-fetch-all)

This command fetches from all remotes.

f m     (magit-submodule-fetch)

This command fetches all submodules. With a prefix argument it fetches all remotes of all submodules.

user option magit-pull-or-fetch

By default fetch and pull commands are available from separate transient prefix command. Setting this to t adds some (but not all) of the above suffix commands to the magit-pull transient.

If you do that, then you might also want to change the key binding for these prefix commands, e.g.:

(setq magit-pull-or-fetch t)
(define-key magit-mode-map "f" 'magit-pull) ; was magit-fetch
(define-key magit-mode-map "F" nil) ; was magit-pull