• #31464
     Prachi #658

    What is the difference between git pull and git fetch in Salesforce?

    What is the difference between git pull and git fetch in Salesforce?



    Hello Prachi

    Git pull command pulls new changes or commits from a particular branch from your central repository and updates your target branch in your local repository.

    Git fetch is also used for the same purpose but it works in a slightly different way. When you perform a git fetch, it pulls all new commits from the desired branch and stores it in a new branch in your local repository. If you want to reflect these changes in your target branch, git fetch must be followed with a git merge. Your target branch will only be updated after merging the target branch and fetched branch. Just to make it easy for you, remember the equation below:

    git pull = git fetch + git merge

    Salesforce | Parul Parul #949

    git fetch really only downloads new data from a remote repository – but it doesn’t integrate any of this new data into your working files. Fetch is great for getting a fresh view on all the things that happened in a remote repository.
    Due to it’s “harmless” nature, you can rest assured: fetch will never manipulate, destroy, or screw up anything. This means you can never fetch often enough.

    git pull, in contrast, is used with a different goal in mind: to update your current HEAD branch with the latest changes from the remote server. This means that pull not only downloads new data; it also directly integrates it into your current working copy files.

    Salesforce | Parul Parul #949

    Adding some points:

    A bare repository is nothing but the .git folder itself i.e. the contents of a bare repository is same as the contents of .git folder inside your local working repository. Use bare repository on a remote server to allow multiple contributors to push their work.


    Salesforce | Pooja Pooja #9

    Git pull – In Salesforce, Git pull can update and merge any remote changes of the present branch you are on.

    Git fetch – In Salesforce, Git fetch can update only the branch you are on, however not merge any changes in.

Viewing 5 posts - 1 through 5 (of 5 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?