
In other words: git pull = git fetch + git merge. After fetching, you can merge the received commits into a local branch, using git merge.Īnd what about git pull? You can think of this command as a shortcut: it does all of the above in a single step. When you run this command, Git fetches the new commits from the remote.

Git fetch, to put it simply, is the process of updating the remote-tracking branches. Let’s see how they’re similar and how they’re not. Despite being related, they’re two different operations. It’s common for beginners to mix up git pull and git fetch. What Is the Difference Between Pull and Fetch in Git? Then, your local branch is compared to the remote-tracking branch and receives the new commits so it can catch up to the current state of the remote branch. First, your remote-tracking branch is synced with the “true” branch in the remote repository. Git pull, in a nutshell, is a two-part process. What Is Git Pull, Really? How Does It Work? Time to understand git pull more in-depth. You can think of remote-tracking branches as “read-only” branches that mirror the state of the actual remote branches. Remote-tracking branches are references that live in your local repositories. Your remote repositories also have their branches, which are appropriately called “remote branches.” The last part of this tripod is what makes the whole thing possible: remote-tracking branches. How does that work in practice? For starters, you have your local branches in which you do your work. As soon as you get your remotes configured, you can send and get commits from the branches in your remotes. And, despite being common for projects to have a main remote playing the role of a “central server,” you can also have other remotes configured.įor instance, you can add your coworker’s repository as a remote so both of you can collaborate. As we’ve mentioned, you can have any number of remotes. You collaborate in Git by exchanging information with your remotes. You Collaborate in Git by Sending to and Getting From Remotes In practice, however, most projects will have a “main” remote, which acts as the de facto central server.

Instead, in Git you can have any number of remote repositories, or simply remotes. Git is a decentralized VCS, which means there’s no central server.

Git commits are identified by a unique-ish identifier, which is calculated based on their data, including the name and email of the author, time stamp, commit message and the commit’s parents. Instead of storing the patch-that is, the actual changes introduced-they store a whole snapshot of the project in a specific instant. Unlike in other VCSs, commits in Git aren’t deltas.

To better understand git pull, you need to understand how network operations work in Git.
#Pull master git commands update
What is git pull? In a nutshell, it’s the command you use to update your repository with new changes. Git Pull 101: Understanding Git Networking As is usual for these tutorials, we assume you have Git installed and are at least familiar with working with the command line.
#Pull master git commands how to
You’ll learn what this command does and how to use it, in addition to learning useful fundamentals about network operations in Git. This post will explain git pull in detail. To sync with remote repositories, you’ll need to master Git network operations, including git pull. Most of the time, however, you’ll be collaborating with other people. If you’re working alone on a project, you can use Git locally just fine.
