1 00:00:00,150 --> 00:00:00,900 All right. 2 00:00:00,900 --> 00:00:03,990 So we have one more step to get our code up on GitHub. 3 00:00:04,170 --> 00:00:05,880 We just need to push it up. 4 00:00:05,910 --> 00:00:09,960 So if you remember option one, what we're following here. 5 00:00:10,200 --> 00:00:14,700 Option one out of two is to create a new repo on GitHub, which we've done. 6 00:00:14,850 --> 00:00:18,820 Connect the local repo by adding a remote to our GitHub repo. 7 00:00:18,840 --> 00:00:20,850 We just did that in the previous video. 8 00:00:20,880 --> 00:00:25,200 Now we need to push our changes up so we have our existing repo. 9 00:00:25,230 --> 00:00:29,760 I'm doing that stupid Great Gatsby novel fake repo. 10 00:00:30,150 --> 00:00:37,260 I created an empty GitHub repo and then I set my remote called Origin so that it points at this empty 11 00:00:37,260 --> 00:00:38,280 GitHub repo. 12 00:00:38,520 --> 00:00:41,430 So the final step is to push up. 13 00:00:41,820 --> 00:00:44,970 So we do this using the git push command. 14 00:00:45,150 --> 00:00:47,580 Again, this is not GitHub specific though. 15 00:00:47,580 --> 00:00:53,910 Everything will be pushing to will be a GitHub repo, but the get push command is a git command that 16 00:00:53,910 --> 00:00:55,530 existed long before GitHub. 17 00:00:56,040 --> 00:01:00,030 And there are many other places where you can have a hosted repo that you can push to. 18 00:01:00,180 --> 00:01:02,370 So it works with any remote. 19 00:01:02,580 --> 00:01:06,770 Basically the syntax is git push and then a remote. 20 00:01:06,780 --> 00:01:10,980 In our case we just have one which is origin, but we can have multiple. 21 00:01:10,980 --> 00:01:18,030 So we have to tell git where we're pushing, what's the destination repository and what branch to push. 22 00:01:18,240 --> 00:01:22,080 So, you know, we might have a really large repo with a ton of branches. 23 00:01:22,080 --> 00:01:25,590 Like actually we don't have a ton here, but we've got a couple. 24 00:01:27,180 --> 00:01:28,530 No, just to. 25 00:01:28,800 --> 00:01:34,350 Oh, well, this is because this video or this repo was created before we went into branching. 26 00:01:34,350 --> 00:01:39,390 But some of our repos have like, I don't know, seven, eight, maybe ten branches and you may not 27 00:01:39,390 --> 00:01:43,860 want all of them on GitHub or you may not want to push them all at once at least. 28 00:01:43,860 --> 00:01:48,990 So when we push, we call out a particular branch that we want to send to GitHub. 29 00:01:49,020 --> 00:01:55,230 Often that will be your master or main branch, but you can push any branch up to GitHub and I'll show 30 00:01:55,230 --> 00:01:55,800 you that. 31 00:01:55,800 --> 00:02:03,240 So this is a really common command to get Push Origin Master, though it is becoming slightly less common 32 00:02:03,240 --> 00:02:06,510 as more people rename their master branch to Main. 33 00:02:06,510 --> 00:02:10,020 If you recall, we talked about this early on when I introduced branching. 34 00:02:10,020 --> 00:02:18,330 It now comes up again Master versus Main because GitHub, as I mentioned at the end of 2020, decided 35 00:02:18,330 --> 00:02:23,340 to make the default branch name on a GitHub repo main instead of master. 36 00:02:23,340 --> 00:02:30,210 So their instructions tell you to add a remote called Origin, but then rename your branch the master 37 00:02:30,210 --> 00:02:34,020 branch to Main and then push Main. 38 00:02:34,350 --> 00:02:36,600 So I will do this as well. 39 00:02:36,720 --> 00:02:39,000 In a separate video I will show this process. 40 00:02:39,000 --> 00:02:40,650 It's the exact same process. 41 00:02:40,650 --> 00:02:44,310 We rename a branch, we name it main, and then we push up Main. 42 00:02:45,150 --> 00:02:49,620 But I'm going to start with Master, just to keep this as simple as possible, because we have a master 43 00:02:49,620 --> 00:02:50,700 branch, right? 44 00:02:50,940 --> 00:02:54,690 We've been working with the term master, so we'll start there first. 45 00:02:55,710 --> 00:03:02,730 So I have this remote called origin as we already discussed, get remote dash v, we see what it's pointing 46 00:03:02,730 --> 00:03:09,900 to and it's always a good idea to see what what we have, if we have any uncommitted changes that won't 47 00:03:09,900 --> 00:03:13,050 go up otherwise we're ready. 48 00:03:13,050 --> 00:03:20,070 We're going to do a git push and then origin is where we're pushing to and then master is the branch 49 00:03:20,070 --> 00:03:21,420 we are pushing up. 50 00:03:21,930 --> 00:03:24,240 Okay, so this is what our GitHub looks like right now. 51 00:03:24,240 --> 00:03:24,810 I'll refresh. 52 00:03:24,810 --> 00:03:27,210 There's nothing here except these instructions. 53 00:03:27,390 --> 00:03:28,650 This is the repo. 54 00:03:28,710 --> 00:03:32,730 But now I'm going to push and there's going to be a substantial change. 55 00:03:33,360 --> 00:03:34,590 And remember. 56 00:03:34,590 --> 00:03:37,350 Oh, gosh, I put images in this repo, didn't I? 57 00:03:37,590 --> 00:03:39,900 Well, that's why it's taking a little bit. 58 00:03:39,930 --> 00:03:43,740 So you can see here I have some images in that mood board. 59 00:03:43,890 --> 00:03:50,280 Usually you don't include images in a or at least not large images like I have, but it finished up. 60 00:03:50,430 --> 00:03:57,230 Most repos are going to push way, way, way faster than that because they're usually just code. 61 00:03:57,240 --> 00:03:59,400 So I'm going to refresh the page. 62 00:04:00,870 --> 00:04:03,420 And now we see something entirely different. 63 00:04:03,720 --> 00:04:04,110 Right. 64 00:04:04,110 --> 00:04:05,570 We don't see those instructions. 65 00:04:05,580 --> 00:04:08,900 Now we see our file contents. 66 00:04:08,910 --> 00:04:13,290 So chapter one, chapter two, chapter three, characters outline. 67 00:04:13,650 --> 00:04:15,570 We see different commits. 68 00:04:15,810 --> 00:04:21,480 I'll actually do a separate video where I walk through what we see, but we also have access to things 69 00:04:21,480 --> 00:04:22,680 like contributors. 70 00:04:22,680 --> 00:04:29,070 We can see there's only one branch which is the master branch, and I can take a look at chapter one. 71 00:04:29,070 --> 00:04:31,860 For example, here's the contents of Chapter one. 72 00:04:33,190 --> 00:04:33,790 Okay. 73 00:04:34,120 --> 00:04:35,950 So we have our code up here. 74 00:04:36,160 --> 00:04:40,060 Now, what I want to show you is that we can push any branch. 75 00:04:40,300 --> 00:04:44,740 I talked about pushing master because that's what we have on this project. 76 00:04:44,740 --> 00:04:49,730 But if we make a new branch, which I'll just make, what should my branch be called? 77 00:04:49,750 --> 00:04:52,540 How about empty or nearly empty? 78 00:04:53,410 --> 00:04:58,420 I switch to that branch and I'm just going to delete pretty much everything in here. 79 00:04:58,450 --> 00:05:00,610 I'm going to delete Moodboard for sure. 80 00:05:02,070 --> 00:05:04,650 So that's actually our m dash ref to get rid of that. 81 00:05:04,650 --> 00:05:05,550 It's a folder. 82 00:05:06,780 --> 00:05:08,280 And erm. 83 00:05:08,310 --> 00:05:09,470 How about all chapters? 84 00:05:09,570 --> 00:05:10,830 Chapter one. 85 00:05:11,130 --> 00:05:13,350 I'll just leave the outline and the characters. 86 00:05:13,350 --> 00:05:16,290 So now, whoops, this is all we have. 87 00:05:16,650 --> 00:05:24,090 I'm on a branch, though, called Empty, so I'm going to add everything and then get, commit, delete 88 00:05:24,270 --> 00:05:25,980 most things. 89 00:05:26,910 --> 00:05:27,530 All righty. 90 00:05:27,540 --> 00:05:33,210 Now, if I want to push the code that I just changed, I want to push my last commit from this branch. 91 00:05:33,210 --> 00:05:35,250 Remember, I'm on the empty branch. 92 00:05:35,340 --> 00:05:37,800 I need to push the empty branch. 93 00:05:37,800 --> 00:05:40,230 So let me illustrate that here. 94 00:05:40,230 --> 00:05:41,430 I've got some diagrams. 95 00:05:41,880 --> 00:05:46,020 What we just did was we pushed up our master branch to GitHub. 96 00:05:46,020 --> 00:05:47,490 So there was nothing on GitHub. 97 00:05:47,490 --> 00:05:48,720 I pushed up master. 98 00:05:48,720 --> 00:05:53,430 Whoops, I went to far get push origin master assuming our remote is named Origin. 99 00:05:54,100 --> 00:05:58,240 Now in this diagram, I have a second branch called New Feature. 100 00:05:58,270 --> 00:05:59,620 I'm going to push that up. 101 00:05:59,620 --> 00:06:02,320 Get Push Origin new feature. 102 00:06:03,040 --> 00:06:05,590 In our case, our branch is called empty. 103 00:06:05,590 --> 00:06:09,000 So get push origin empty. 104 00:06:09,010 --> 00:06:11,260 I don't have to be on this branch, by the way. 105 00:06:11,260 --> 00:06:16,150 I happened to be on it, which is very common that you're taking a look at what's on a branch and then 106 00:06:16,150 --> 00:06:18,250 you push it up, but you don't have to be on it. 107 00:06:18,490 --> 00:06:20,620 So get push origin empty. 108 00:06:22,390 --> 00:06:26,320 And remember, if it asks you for your password, not a big deal. 109 00:06:26,410 --> 00:06:32,320 It put your email and password or your username and password, but go back and check out the SSH video 110 00:06:32,320 --> 00:06:37,660 so that it doesn't have to keep bugging you, you know, asking you for a password every time you push. 111 00:06:38,590 --> 00:06:39,220 Okay. 112 00:06:39,370 --> 00:06:41,560 So now I'm going to refresh. 113 00:06:43,320 --> 00:06:45,330 And it doesn't look like much changed. 114 00:06:45,330 --> 00:06:52,110 But now we have two branches and we can see the two branches here, master and empty, and I can switch 115 00:06:52,110 --> 00:06:52,860 between them. 116 00:06:54,190 --> 00:06:55,510 And this is my empty branch. 117 00:06:55,510 --> 00:06:59,530 I'm just viewing it on GitHub and you'll see it just has two files. 118 00:06:59,530 --> 00:06:59,930 Right? 119 00:06:59,950 --> 00:07:01,180 Go back to Master. 120 00:07:02,200 --> 00:07:03,700 And I have a whole bunch of stuff. 121 00:07:05,290 --> 00:07:09,730 So I'm going to just go through this process one more time, just to make it very clear, I'm going 122 00:07:09,730 --> 00:07:15,400 to go back to Master, get switch master and let's make some some changes. 123 00:07:15,400 --> 00:07:16,780 We'll do some new work here. 124 00:07:17,290 --> 00:07:19,180 How about chapter four? 125 00:07:19,870 --> 00:07:21,100 Dot txt. 126 00:07:21,640 --> 00:07:22,300 All righty. 127 00:07:22,300 --> 00:07:24,820 And I'll just leave it blank, I guess. 128 00:07:25,970 --> 00:07:27,230 And I'm going to add that. 129 00:07:27,230 --> 00:07:30,320 So get ADD Chapter four, get commit. 130 00:07:31,100 --> 00:07:33,080 Begin Chapter four. 131 00:07:36,200 --> 00:07:37,040 Pop quiz. 132 00:07:37,040 --> 00:07:38,060 What's on my GitHub? 133 00:07:38,060 --> 00:07:40,970 What's the most recent comet that I'll see on the GitHub repo? 134 00:07:41,720 --> 00:07:43,400 Nothing has changed on GitHub. 135 00:07:43,430 --> 00:07:45,170 It's still exactly the same. 136 00:07:45,440 --> 00:07:47,600 If we're looking at the master branch, nothing's changed. 137 00:07:47,600 --> 00:07:51,350 If we're looking at the empty branch, nothing has changed since we last pushed. 138 00:07:51,800 --> 00:07:56,090 GitHub doesn't just stay in sync automatically with my local repo. 139 00:07:56,120 --> 00:07:57,320 I have to push. 140 00:07:57,320 --> 00:08:00,000 So why don't I push up that commit? 141 00:08:00,020 --> 00:08:01,910 Chapter four begin chapter four. 142 00:08:01,910 --> 00:08:03,680 Now I said push up that commit. 143 00:08:03,800 --> 00:08:06,110 We don't select a specific commit. 144 00:08:06,110 --> 00:08:08,810 We push an entire branch as we've talked about. 145 00:08:08,900 --> 00:08:10,940 So I made that commit on the master branch. 146 00:08:10,940 --> 00:08:14,030 So I'll push that up, get push origin. 147 00:08:14,030 --> 00:08:15,950 The only remote we have right now. 148 00:08:15,950 --> 00:08:17,000 Origin Master. 149 00:08:19,090 --> 00:08:25,020 Now, if we head over here and refresh, we see first of all, my most recent commit begin chapter four 150 00:08:25,030 --> 00:08:26,170 one minute ago. 151 00:08:26,500 --> 00:08:29,590 We also see the actual updated contents. 152 00:08:29,590 --> 00:08:29,760 Right. 153 00:08:29,770 --> 00:08:32,020 Chapter four text is right there. 154 00:08:32,470 --> 00:08:32,890 Okay. 155 00:08:32,890 --> 00:08:38,470 So in the next video, I'm going to kind of walk through a GitHub repository, show you how we view 156 00:08:38,470 --> 00:08:43,179 the commits, the branches, diffs or changes, all that stuff. 157 00:08:43,179 --> 00:08:48,340 And then we'll get some more practice with pushing and we'll talk about renaming to use the main branch.