Git pull

The git pull command downloads the content from a remote repository and immediately updates your local repository with the latest content. It combines the actions of git fetch and git merge, making it a convenient way to keep your local repository up to date.



Tutorials dojo strip

Initial Example

$ git pull <remote_url>




PULL Options

OptionDescription
--rebaseRebase the current branch on top of the upstream branch after fetching.
--no-rebaseEnsure the pull is done without rebasing.
--no-commitMerge fetched changes into the current branch but do not commit them.
--no-ffCreate a merge commit even when a fast-forward merge is possible.
--ff-onlyRefuse to merge and exit unless the merge can be resolved as a fast-forward.
--squashCreate a single commit for all the changes pulled.
--editAllow editing of the commit message before committing.
--autostashAutomatically stash local changes before pulling and reapply them afterward.
--quietSuppress summary messages.
--verboseProvide detailed output during the pull process.
--tagsFetch all tags from the remote repository.
--allFetch changes from all remotes.




Examples

1. Basic Pull

This command fetches and merges changes from the main branch of the origin remote repository.

   $ git pull origin main

2. Pull from a Specific Remote and Branch

This command fetches and merges changes from the feature-branch branch of the specified remote repository.

   $ git pull https://github.com/example/repo.git feature-branch

3. Pull with Rebase

This command fetches changes from the main branch of the origin remote repository and rebases your current branch on top of the fetched changes.

   $ git pull --rebase origin main

Scroll to Top