1 00:00:00,240 --> 00:00:03,070 To answer this question, let's think about what commits were present on 2 00:00:03,070 --> 00:00:06,210 GitHub and in your local repository before and after git fetch. 3 00:00:07,250 --> 00:00:08,600 When you cloned the repository, 4 00:00:08,600 --> 00:00:11,900 the latest commit on it was Larry's commit adding the chili recipe, so 5 00:00:11,900 --> 00:00:15,330 that also became the latest commit in your local repository. 6 00:00:15,330 --> 00:00:17,230 Of course, there were other previous commits, but 7 00:00:17,230 --> 00:00:19,810 I'm leaving them out here for the sake of space. 8 00:00:19,810 --> 00:00:22,240 Now you made a commit adding a new spice, so 9 00:00:22,240 --> 00:00:25,590 that commit is also present in your local repository. 10 00:00:25,590 --> 00:00:27,815 And that's where your master branch is. 11 00:00:27,815 --> 00:00:31,530 origin/master still points to the commit that was on the remote at 12 00:00:31,530 --> 00:00:33,210 the time that you cloned. 13 00:00:33,210 --> 00:00:36,654 After you cloned, Sarah added the no cumin commit on GitHub, but 14 00:00:36,654 --> 00:00:40,280 your origin/master branch won't reflect that yet. 15 00:00:40,280 --> 00:00:42,960 So, this is the state of master on GitHub. 16 00:00:42,960 --> 00:00:43,890 Now, this was the state of 17 00:00:43,890 --> 00:00:46,800 both repositories right before you ran git fetch. 18 00:00:46,800 --> 00:00:51,640 So, if you ran git log origin/master, you should have seen that Larry's commit 19 00:00:51,640 --> 00:00:55,760 adding the chili recipe was present, but your commit adding a new spice and 20 00:00:55,760 --> 00:01:00,490 Sarah's commit removing cumin were not present on the origin/master branch. 21 00:01:00,490 --> 00:01:03,865 If you run git status, you should have seen that your branch was ahead of 22 00:01:03,865 --> 00:01:06,390 origin/master by one commit. 23 00:01:06,390 --> 00:01:10,720 This makes sense because git log and git status both run without internet access. 24 00:01:10,720 --> 00:01:12,940 Suppose you were somewhere without internet access when you 25 00:01:12,940 --> 00:01:14,340 ran these commands. 26 00:01:14,340 --> 00:01:18,510 Your local git repository would have no idea that the cumin commit existed. 27 00:01:18,510 --> 00:01:21,220 So, of course, the cumin commit wouldn't be shown when you ran git 28 00:01:21,220 --> 00:01:22,505 log origin/master. 29 00:01:23,920 --> 00:01:28,380 And git status wouldn't know that your branches were actually out of sync. 30 00:01:28,380 --> 00:01:30,660 It thinks that your branch is just ahead. 31 00:01:30,660 --> 00:01:34,710 Now when you run git fetch, git fetches the no cumin commit and 32 00:01:34,710 --> 00:01:38,370 updates the branch origin/master to point to that new commit. 33 00:01:38,370 --> 00:01:42,420 Your local master still points at the new spice commit like it did before. 34 00:01:42,420 --> 00:01:46,350 So at this point, you have a local copy of the no cumin commit saved, and 35 00:01:46,350 --> 00:01:48,030 you can access it via git log. 36 00:01:48,030 --> 00:01:52,340 If you run git log now, you'll see both the no cumin commit and 37 00:01:52,340 --> 00:01:53,760 the chili commit. 38 00:01:53,760 --> 00:01:56,740 You still won't see your new spice commit since that's only on 39 00:01:56,740 --> 00:01:58,350 your local master branch. 40 00:01:58,350 --> 00:02:00,340 Now, since both origin slash master and 41 00:02:00,340 --> 00:02:02,955 master have one commit that is not present on the other, 42 00:02:02,955 --> 00:02:07,325 git status will show that your branch is out of sync with origin/master.