• Pricing
DashboardContact Sales
  • Blogs
  • Discover
  • Docs
  • Community
  • AgentBeta
⌘K

Over 80,000,000 Cloud Servers Launched

Over 80,000,000 Cloud Servers Launched

Cloud ComputeCloud GPUBare MetalFile SystemObject StorageBlock StorageManaged DatabasesCDNServerlessKubernetesContainer RegistryDirect ConnectLoad Balancers
RegionsAdvanced NetworkControl PanelOperating SystemsUpload ISO
Industry CloudOne-Click DeploymentUse Cases
Browse AppsBecome a Vendor
FAQDevelopers / APIsVultr DocsServer StatusBug BountyPromotionsSolution PartnersStart-Up Programs
Our TeamNewsBrand AssetsReferral ProgramCreator ProgramCareersSLALegalVultr Trust CenterContactYour Privacy ChoicesSubprocessorsAccessibility
Contact SalesSign Up

© Vultr 2026 | VULTR is a registered trademark of The Constant Company, LLC.

Terms of ServiceAUPDMCAPrivacy PolicyCookie Policy

In this Article

The Short Answer VersionRun the Git Fetch CommandRun the Git Merge CommandRun the Git Pull CommandConclusion
  1. Docs
  2. Articles & Guides
  3. Development

How to Pull Changes in Git

5 min readUpdated 18 July 2025
0 comments
How to Pull Changes in Git header image

Pulling changes in Git keeps your local branch in sync with the latest updates from a remote repository. This is essential when collaborating on shared projects. Regularly pulling ensures that you are working on top of the current branch state and helps prevent conflicts. You can either pull changes manually by running git fetch and git merge, or automatically using git pull, which combines both steps into a single command.

In this article, you will use git fetch to retrieve the latest changes, git merge to integrate those changes into your local branch, and git pull to automate the entire process. Pulling changes before committing or pushing updates keeps your local branch aligned with the remote branch and ensures a smooth workflow.

The Short Answer Version

Use one of the following methods to pull changes from a remote Git repository:


# Fetch the latest changes from a remote repository (does not merge them)
$ git fetch <remote>

# Merge the fetched changes into your current branch
$ git merge <remote>/<branch>

# Fetch and merge changes in one step
$ git pull <remote> <branch>

This gives you the option to either verify changes manually (git fetch + git merge) or automatically pull and merge with git pull.

Run the Git Fetch Command

The git fetch command downloads the latest changes from a remote repository and updates your remote-tracking branches. It does not modify your working directory or current branch, allowing you to review remote changes before deciding whether to merge them. This is useful when you want to inspect changes or stay in sync with the remote repository without introducing changes into your local branch immediately.

Command Syntax

git fetch [<options>] <remote> [<branch>]
  • <remote>: Specifies the remote repository (such as origin).
  • <branch> (optional): Specifies a particular branch to fetch.
  • <options>: Optional flags that modify the behavior of the fetch.

Common Options

OptionDescription
git fetch <remote>Fetches all branches from the specified remote.
git fetch <remote> <branch>Fetches a specific branch from the remote.
git fetch --allFetches from all remotes defined in your repository.
git fetch --pruneRemoves remote-tracking references that no longer exist on the remote.
git fetch --dry-runShows what would be fetched, without fetching it.
git fetch --depth=<n>Performs a shallow fetch with only the latest n commits.
git fetch --tagsFetches all tags from the remote.
git fetch --no-tagsSkips fetching tags.
git fetch --forceForces overwriting local tracking branches with remote changes.

Command Demonstration

  1. Verify the remote repository configured for your project.

    CONSOLE
    $ git remote -v
    Powered by Vultr AgentBeta

    Output.

    origin  https://github.com/example/sample-project.git (fetch)
    origin  https://github.com/example/sample-project.git (push)
  2. Fetch changes from the remote repository.

    CONSOLE
    $ git fetch origin main
    Powered by Vultr AgentBeta

    Output.

    remote: Enumerating objects: 515, done.
    remote: Counting objects: 100% (103/103), done.
    remote: Compressing objects: 100% (51/51), done.
    remote: Total 515 (delta 76), reused 52 (delta 52), pack-reused 412 (from 3)
    Receiving objects: 100% (515/515), 1.43 MiB | 20.39 MiB/s, done.
    Resolving deltas: 100% (222/222), done.
    From https://github.com/example/sample-project.git
    * branch            main       -> FETCH_HEAD
    * [new branch]      main       -> origin/main
  3. Check the status of your local branch.

    CONSOLE
    $ git status
    Powered by Vultr AgentBeta

    Output if your branch is behind:

    On branch main
    Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded.
     (use "git pull" to update your local branch)
    
    nothing to commit, working tree clean
  4. Inspect the fetched commits before merging.

    CONSOLE
    $ git log origin/main
    Powered by Vultr AgentBeta

Run the Git Merge Command

The git merge command integrates changes from one branch into your current branch. You can use it to apply updates from a remote-tracking branch (such as origin/main) or to merge a feature branch into a mainline branch. After fetching changes from a remote repository, use git merge to synchronize those changes into your local branch.

Command Syntax

git merge [<options>] <branch>
  • <branch>: The branch to merge into your current branch (for example, origin/main).
  • <options>: Optional flags that modify merge behavior.

Common Options

OptionDescription
git merge --no-ff <branch>Always creates a merge commit, even if a fast-forward is possible.
git merge --ff <branch>Allows fast-forward merge if possible.
git merge --ff-only <branch>Cancels the merge unless it can be fast-forwarded.
git merge --squash <branch>Squashes all changes into a single commit (does not record a merge commit).
git merge --abortCancels the merge and restores the previous branch state.
git merge --no-commit <branch>Performs the merge but pauses before creating a merge commit.
git merge --edit <branch>Opens the commit message editor when creating a merge commit.
git merge --allow-unrelated-histories <branch>Allows merging branches with unrelated histories.
git merge --quiet <branch>Suppresses normal output except for errors.
git merge --stat <branch>Displays a diffstat summary after the merge.

Command Demonstration

  1. Verify the current branch in your local repository.

    CONSOLE
    $ git branch
    Powered by Vultr AgentBeta
  2. Merge changes from the remote-tracking branch into your current branch.

    CONSOLE
    $ git merge origin/<branch>
    Powered by Vultr AgentBeta

    Example:

    CONSOLE
    $ git merge origin/main
    Powered by Vultr AgentBeta

    The command applies updates from origin/main to your current branch. If your local branch and origin/main have diverged, Git creates a merge commit with a default message such as:

    Merge branch 'origin/main' into main
  3. Check the branch status to verify the merge result.

    CONSOLE
    $ git status
    Powered by Vultr AgentBeta

    Output.

    On branch main
    Your branch is up to date with 'origin/main'.

Run the Git Pull Command

The git pull command fetches changes from a remote repository and automatically merges them into your current branch in a single step. It is equivalent to running git fetch followed by git merge. Use git pull to update your local branch with the latest upstream changes before pushing new commits or continuing local work.

If your local branch is behind the remote, git pull fast-forwards it when possible. In case of divergent changes, Git may prompt you to resolve merge conflicts manually or rebase your branch depending on your configuration.

Command Syntax

git pull [<options>] <remote> <branch>
  • <remote>: The remote repository to pull changes from (for example, origin).
  • <branch>: The branch to pull changes from (for example, main).
  • <options>: Optional flags that control how Git fetches and merges changes.

Common Options

OptionDescription
git pull --rebase <remote> <branch>Reapplies local commits on top of the fetched branch to maintain linear history.
git pull --no-rebase <remote> <branch>Disables rebasing and performs a merge instead.
git pull --ff <remote> <branch>Allows fast-forward merge if possible.
git pull --ff-only <remote> <branch>Cancels the pull unless it can be fast-forwarded.
git pull --no-commit <remote> <branch>Merges changes but does not automatically create a commit.
git pull --no-ff <remote> <branch>Always creates a merge commit, even if a fast-forward is possible.
git pull --verbose <remote> <branch>Displays detailed output about the pull process.
git pull --quiet <remote> <branch>Suppresses output except for errors.
git pull --allFetches all remotes in the current branch.
git pull --allow-unrelated-histories <remote> <branch>Allows merging unrelated histories.
git pull --no-stat <remote> <branch>Disables the diffstat summary after merge.

Command Demonstration

  1. Verify the current branch in your local repository.

    CONSOLE
    $ git branch
    Powered by Vultr AgentBeta
  2. Pull changes from the remote repository.

    CONSOLE
    $ git pull origin <branch>
    Powered by Vultr AgentBeta

    Example:

    CONSOLE
    $ git pull origin main
    Powered by Vultr AgentBeta

    The git pull command automatically runs:

    • git fetch origin main: Fetches the latest changes from the remote.
    • git merge origin/main: Merges the fetched changes into your current branch.
  3. Check the branch status after pulling changes.

    CONSOLE
    $ git status
    Powered by Vultr AgentBeta

    Output.

    On branch main
    Your branch is up to date with 'origin/main'.

    You should see that your branch is now up to date, confirming that the merge completed successfully.

Handling Merge Conflicts

If your local branch has diverged and a merge conflict occurs during git pull, Git displays an output similar to the following:

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

To resolve the conflict, choose one of the following:

  • Run git pull --no-rebase origin main to perform a merge commit after resolving conflicts.
  • Run git pull --rebase origin main to reapply your local commits on top of the remote branch after resolving conflicts.

After resolving conflicts:

  1. Stage the resolved files.

    CONSOLE
    $ git add <file>
    Powered by Vultr AgentBeta
  2. Complete the merge or rebase.

    CONSOLE
    $ git commit
    Powered by Vultr AgentBeta

    Or, if using --rebase:

    CONSOLE
    $ git rebase --continue
    Powered by Vultr AgentBeta

Conclusion

In this article, you learned how to pull changes in Git using the git fetch, git merge, and git pull commands. You can use git pull for a quick way to update your local branch with the latest remote changes, or use git fetch and git merge to manually review and control the updates before applying them.

These techniques help you maintain an up-to-date local repository and avoid conflicts when collaborating with others. To continue managing your Git workflow, see also How to Commit Changes in Git.

Tags:Git

Tech Talk: Running a Self-Improving AI Agent with Hermes on Vultr

Have a suggestion or found an issue with this article?

About the Author

HM

Humphrey Mpairwe

View Profile
View Profile

More to Explore

Show More
tech-talk-thumbnail

Tech Talk: Running a Self-Improving AI Agent with Hermes on Vultr

tech-talk-thumbnail

Tech Talk: Implementing Fine-Grained Access Control with Vultr IAM

tech-talk-thumbnail

Tech Talk: Getting Started with Vultr IAM

tech-talk-thumbnail

Tech Talk: Simplifying Zero-Trust Networking with NetBird on Vultr Marketplace

Show More

0 Comments

Start the conversation

Be the first to comment and share your perspective with the community.