1 00:00:00,180 --> 00:00:05,310 All right, so now it's time to get some practice on your own with the GitHub basics, creating GitHub 2 00:00:05,310 --> 00:00:09,990 repositories, setting up remotes, pushing that sort of thing. 3 00:00:10,110 --> 00:00:15,480 So nothing crazy here, but really the bread and butter of working with GitHub is just getting your 4 00:00:15,480 --> 00:00:21,180 code up on GitHub and then as we'll soon see, getting code down, pulling down from GitHub, which 5 00:00:21,180 --> 00:00:22,800 we haven't yet learned anyway. 6 00:00:22,800 --> 00:00:28,800 As always, for these exercises, you can find the link to get to these instructions as a resource with 7 00:00:28,800 --> 00:00:29,550 this video. 8 00:00:29,550 --> 00:00:35,310 So I recommend you open that up and probably like always just pause this video and read the instructions. 9 00:00:35,310 --> 00:00:37,680 If you have questions, come back to this video. 10 00:00:38,190 --> 00:00:43,890 So the core idea here is that you're going to make a new repository locally on your computer, then 11 00:00:43,890 --> 00:00:48,000 you'll go to GitHub and make a GitHub repository and then you'll connect the two. 12 00:00:48,790 --> 00:00:53,500 Then after that you'll make a file called favorites. 13 00:00:53,800 --> 00:00:58,690 TXT an empty file you'll save and you'll make your first commit. 14 00:00:58,720 --> 00:01:00,580 Now this part is optional. 15 00:01:00,580 --> 00:01:05,050 If you want to go with Main instead of master, I'm going to be using Main just to be consistent in 16 00:01:05,050 --> 00:01:05,770 this file. 17 00:01:05,770 --> 00:01:11,200 But if you choose to stay with master, then just sub that in wherever you see main so you'll make a 18 00:01:11,200 --> 00:01:12,220 new file favorites. 19 00:01:12,220 --> 00:01:17,950 TXT Leave it empty, make your first commit on the main branch, then push up that main branch to GitHub. 20 00:01:17,980 --> 00:01:21,370 So make sure that you see your empty file on GitHub. 21 00:01:21,400 --> 00:01:27,700 Then the next bit is to make two branches a foods branch and a movies branch, both based on the main 22 00:01:27,700 --> 00:01:28,270 branch. 23 00:01:28,600 --> 00:01:33,370 Then switch to the foods branch, add three or more of your favorite foods to the file, add and commit 24 00:01:33,370 --> 00:01:34,210 your changes. 25 00:01:34,240 --> 00:01:35,920 Then switch to the movies branch. 26 00:01:35,920 --> 00:01:38,650 Add three or more of your favorite movies to the favorites file. 27 00:01:38,680 --> 00:01:45,010 Add and commit your changes, then push up your foods branch to GitHub and make sure you see it on GitHub. 28 00:01:45,010 --> 00:01:49,360 If you refresh the page and then do the same thing for the movies branch, push up the movies branch 29 00:01:49,360 --> 00:01:53,920 and then we get to this step where I'd like you to merge the foods branch. 30 00:01:53,920 --> 00:01:55,300 Let me fix the highlighting. 31 00:01:55,330 --> 00:01:56,320 Okay, there we go. 32 00:01:56,320 --> 00:02:02,020 So you'll merge the foods branch into the main branch and then you'll merge the movies branch into the 33 00:02:02,020 --> 00:02:02,770 main branch. 34 00:02:02,770 --> 00:02:08,350 So you should now have, after this step, a favorites file that contains both your favorites movies, 35 00:02:08,350 --> 00:02:15,040 both your favorite movies and your favorite foods in the same file favorites on the main branch. 36 00:02:15,040 --> 00:02:16,930 So now the main branch has changed. 37 00:02:16,930 --> 00:02:18,370 GitHub doesn't have that. 38 00:02:18,370 --> 00:02:22,360 So push up the latest work from that main branch, push it up to GitHub. 39 00:02:22,720 --> 00:02:24,460 So that's the basic steps, right? 40 00:02:24,460 --> 00:02:30,070 Make a repo, go on GitHub, make a repo, connect the two, then push up your first little commit on 41 00:02:30,070 --> 00:02:34,900 the main branch, make two branches, do some work on both of them, push each of them up individually, 42 00:02:34,900 --> 00:02:39,370 and then merge those branches locally into the main branch and push the main branch up again. 43 00:02:39,640 --> 00:02:44,680 So please give it a shot on your own unless you are very comfortable with GitHub. 44 00:02:44,680 --> 00:02:49,180 I don't know why you'd be watching this video anyway, but I know it's not the most exciting possible. 45 00:02:49,180 --> 00:02:54,490 I mean, none of these exercises are going to knock your socks off, but very important basic workflow. 46 00:02:54,490 --> 00:02:55,930 So I'll go ahead and do it. 47 00:02:55,930 --> 00:02:58,270 I'll make a new repository locally on my machine. 48 00:02:59,230 --> 00:03:00,190 Let's do it in a folder. 49 00:03:00,190 --> 00:03:01,990 I'll call this favorites. 50 00:03:02,290 --> 00:03:10,270 I'll seed into it and check that I'm not in a repo, I'll init a new repo and then I'll go ahead and 51 00:03:10,270 --> 00:03:12,070 make my new GitHub repository. 52 00:03:12,070 --> 00:03:23,560 So go to GitHub, click the plus new repository and I'll just call this 1gh favorites, exercise, name 53 00:03:23,560 --> 00:03:24,640 it, whatever you'd like. 54 00:03:24,970 --> 00:03:27,010 I'll keep it public if you want to take a look. 55 00:03:27,010 --> 00:03:29,830 There's not really going to be much to look at, but you're welcome to. 56 00:03:30,340 --> 00:03:31,750 And then I'm going to create it. 57 00:03:33,390 --> 00:03:38,880 And then the next step is to connect my local repo to the GitHub repo, which really just means add 58 00:03:38,880 --> 00:03:39,750 this remote. 59 00:03:40,170 --> 00:03:46,800 So I'm going to add that remote and then optionally rename my master branch to Main. 60 00:03:46,800 --> 00:03:48,270 We can just copy that. 61 00:03:48,540 --> 00:03:52,470 Assuming that we're on the master branch or in this case we're not even on a branch yet. 62 00:03:52,470 --> 00:03:58,370 So I will need to make that master branch or I will need to do some work, but then I can rename it. 63 00:03:58,380 --> 00:04:00,480 So as you can see, I'm not even on a branch yet. 64 00:04:00,480 --> 00:04:02,730 I don't have any commits, so there's no branch reference. 65 00:04:02,730 --> 00:04:09,050 But I'll just save that line for just a moment because next we're going to make a new file called Favorites. 66 00:04:09,060 --> 00:04:12,450 That text will leave it empty and make our first commit. 67 00:04:12,450 --> 00:04:16,709 So touch favorites txt then we'll add it. 68 00:04:16,709 --> 00:04:19,290 So get add favorites and we'll commit. 69 00:04:19,320 --> 00:04:23,070 Just do something like add empty favorites file. 70 00:04:24,630 --> 00:04:28,620 So now we see Master there and I'm going to rename that to Main. 71 00:04:28,980 --> 00:04:32,700 Right so I type get status we see on branch main. 72 00:04:32,910 --> 00:04:35,340 If I type git branch, we don't have the master branch anymore. 73 00:04:35,340 --> 00:04:37,740 So if you want to go with Main, that's how you do it. 74 00:04:38,280 --> 00:04:41,490 Next, we need to push up this main branch to GitHub. 75 00:04:41,490 --> 00:04:44,100 Right now nothing is up here just empty. 76 00:04:44,490 --> 00:04:52,200 So get push origin if that's the name of our remote and you can always check get remote be it is origin 77 00:04:52,200 --> 00:04:54,030 if you just copied and pasted from github. 78 00:04:54,030 --> 00:05:03,420 So git push origin and then main is my branch and if I refresh here we should see that empty file and 79 00:05:03,420 --> 00:05:04,140 there it is. 80 00:05:05,040 --> 00:05:09,690 So next step we need to create two branches, foods and movies. 81 00:05:09,690 --> 00:05:11,880 So get branch foods. 82 00:05:12,990 --> 00:05:14,550 Get branch movies. 83 00:05:15,330 --> 00:05:20,130 Or I could do get switched dash C or get checkout dash B, I can switch to one of them. 84 00:05:20,130 --> 00:05:28,320 So I'm going to switch to foods if I can spell that and then add two or what I say three of my favorite 85 00:05:28,320 --> 00:05:30,330 foods to the favorites file. 86 00:05:30,480 --> 00:05:32,280 So let me open this file. 87 00:05:34,510 --> 00:05:38,710 And what are my favorite foods that did not think through this at all? 88 00:05:39,940 --> 00:05:44,830 Well, one of them would have to be peppermint ice cream, not just mint chip has to be peppermint ice 89 00:05:44,830 --> 00:05:45,340 cream. 90 00:05:45,850 --> 00:05:47,500 It's not that common anymore. 91 00:05:47,530 --> 00:05:49,510 Used to have it around Christmas as a kid. 92 00:05:50,980 --> 00:05:52,210 What else? 93 00:05:52,480 --> 00:05:55,840 I'm going to sound like such a fatty if I just say my honest favorites. 94 00:05:56,920 --> 00:05:58,030 Soft pretzels. 95 00:05:58,060 --> 00:05:59,410 Oh, I love soft pretzels. 96 00:05:59,410 --> 00:06:03,610 And then I feel like I need to just lie. 97 00:06:03,880 --> 00:06:05,200 How about celery? 98 00:06:05,410 --> 00:06:07,000 I just love celery. 99 00:06:07,270 --> 00:06:11,440 All right, so now I need to add and commit this on the foods branch. 100 00:06:11,860 --> 00:06:19,960 So get add favorites, get commit to em, add favorite foods, not dudes. 101 00:06:20,920 --> 00:06:23,020 And then that's it. 102 00:06:23,140 --> 00:06:29,020 I could skip ahead and just push it up, but I'm going to now switch to the movies branch, get switched 103 00:06:29,020 --> 00:06:32,180 to movies, and add three of my favorite movies in here. 104 00:06:32,200 --> 00:06:38,020 If you've seen any of my other courses, you probably know, or at least maybe you might remember my 105 00:06:38,020 --> 00:06:38,620 favorite movies. 106 00:06:38,620 --> 00:06:39,160 I'm a deist. 107 00:06:39,160 --> 00:06:42,190 I think I say that far too often in my course. 108 00:06:42,190 --> 00:06:42,910 It's great film. 109 00:06:42,910 --> 00:06:44,170 You've got to watch it if you haven't seen it. 110 00:06:44,170 --> 00:06:45,700 And if you don't like it, I get it. 111 00:06:45,700 --> 00:06:46,450 It's not for everyone. 112 00:06:46,450 --> 00:06:49,330 But anyway, how about Fifth Element? 113 00:06:49,330 --> 00:06:50,740 That's another one I like. 114 00:06:50,920 --> 00:06:52,090 Not necessarily. 115 00:06:52,090 --> 00:06:53,290 This is not top three movies. 116 00:06:53,290 --> 00:06:54,130 Not in order. 117 00:06:54,130 --> 00:06:54,760 It doesn't matter. 118 00:06:55,270 --> 00:06:56,440 It doesn't matter at all. 119 00:06:57,250 --> 00:06:58,120 What else? 120 00:06:58,540 --> 00:07:00,560 Here's a fun one I liked quite a bit. 121 00:07:00,580 --> 00:07:02,230 Captain Fantastic. 122 00:07:02,440 --> 00:07:03,760 Viggo Mortensen. 123 00:07:04,210 --> 00:07:04,630 Sure. 124 00:07:04,630 --> 00:07:05,680 I'll say those are my favorites. 125 00:07:05,680 --> 00:07:07,330 Not quite Amadeus, though. 126 00:07:07,330 --> 00:07:08,620 Yeah, always number one. 127 00:07:09,570 --> 00:07:16,810 Okay, so now I'm going to add those changes, get add favorites, get commit, add three of my fave 128 00:07:16,810 --> 00:07:18,010 movies. 129 00:07:18,730 --> 00:07:20,500 And then we get to this step. 130 00:07:20,500 --> 00:07:22,240 Push up the Foods branch to GitHub. 131 00:07:23,140 --> 00:07:28,840 So I can just do get push my remote origin and then the name of the branch foods. 132 00:07:29,920 --> 00:07:35,860 I don't need to be on the foods branch and I'll refresh and we should see a new branch. 133 00:07:35,860 --> 00:07:36,580 There it is. 134 00:07:36,580 --> 00:07:37,480 And we want to verify. 135 00:07:37,480 --> 00:07:38,470 We see our foods. 136 00:07:38,470 --> 00:07:40,420 Whatever you put, they show up here. 137 00:07:40,750 --> 00:07:41,380 Right. 138 00:07:41,380 --> 00:07:45,010 And I'm currently I was looking at that file so that's where I saw this view. 139 00:07:45,040 --> 00:07:52,120 You'd probably see this now push up the movies branch get push origin movies. 140 00:07:55,570 --> 00:07:57,370 And refresh. 141 00:07:57,870 --> 00:08:04,330 OC We see the movies branch and there we are, we see favorites and it has my favorite or some of my 142 00:08:04,330 --> 00:08:05,230 favorite movies. 143 00:08:05,560 --> 00:08:08,980 Then finally merge the food branch into the main branch. 144 00:08:08,980 --> 00:08:14,350 So I'm going to switch to Main and then I'll just show you my favorites. 145 00:08:14,350 --> 00:08:15,670 Files Empty right now. 146 00:08:16,380 --> 00:08:18,720 And I'm going to merge in foods. 147 00:08:19,020 --> 00:08:22,950 So get merge foods and that's just a fast forward. 148 00:08:23,730 --> 00:08:24,900 That's the easy part. 149 00:08:25,050 --> 00:08:27,930 Then I need to merge the moves branch into main. 150 00:08:27,960 --> 00:08:32,370 Now this won't be a fast forward because now there's commits on the main branch that the movies branch 151 00:08:32,370 --> 00:08:33,010 does not have. 152 00:08:33,030 --> 00:08:38,669 So get merge and then movies and we get a lovely conflict. 153 00:08:38,700 --> 00:08:42,780 I'm just going to select accept both changes and there we go. 154 00:08:43,169 --> 00:08:44,430 We'll just leave it like this. 155 00:08:44,700 --> 00:08:46,830 I could put a little heading, I guess, if I wanted that. 156 00:08:46,830 --> 00:08:48,570 Said movies here, man. 157 00:08:48,690 --> 00:08:49,860 I'll just leave it like that. 158 00:08:50,220 --> 00:08:52,950 Anyway, I'm going to resolve the conflict like I just did. 159 00:08:52,960 --> 00:08:57,360 I'm going to add favorites, and then I'll make my commit here. 160 00:08:57,780 --> 00:08:58,800 What should I do? 161 00:08:59,190 --> 00:09:06,990 Let's just clear get commit merge movies and foods into main. 162 00:09:08,490 --> 00:09:11,160 And then finally I need to push that up. 163 00:09:11,550 --> 00:09:11,740 Right. 164 00:09:11,820 --> 00:09:16,050 So I don't have that latest commit on the main branch on GitHub. 165 00:09:16,710 --> 00:09:18,750 If I go to it, it's just an empty file. 166 00:09:19,380 --> 00:09:20,340 Very sad. 167 00:09:20,550 --> 00:09:23,790 Now it's just as simple as get push. 168 00:09:23,880 --> 00:09:28,410 Now, I didn't use Dash you in the previous when I first pushed the first time, so I still need to 169 00:09:28,410 --> 00:09:30,210 say Origin Main. 170 00:09:30,900 --> 00:09:33,300 If I had used dash u, I could just say get push. 171 00:09:34,530 --> 00:09:37,800 So actually it might just figure it out on its own. 172 00:09:37,830 --> 00:09:39,120 No, it does not. 173 00:09:39,350 --> 00:09:39,750 Okay. 174 00:09:39,810 --> 00:09:42,300 So get push origin main. 175 00:09:46,280 --> 00:09:51,140 And if you have questions about that, you there's a standalone video I made on it, so you could go 176 00:09:51,140 --> 00:09:51,980 check that out. 177 00:09:52,430 --> 00:09:53,750 But you probably already know that. 178 00:09:55,760 --> 00:09:56,810 And there we are. 179 00:09:56,960 --> 00:10:04,190 So we see that we have this new commit one minute ago less than that, where we merge movies and foods 180 00:10:04,190 --> 00:10:05,060 into Maine. 181 00:10:05,060 --> 00:10:08,780 And on Maine we see all three on GitHub. 182 00:10:09,110 --> 00:10:10,790 Foods just has the foods. 183 00:10:10,790 --> 00:10:13,250 And movies just has the movies. 184 00:10:13,940 --> 00:10:14,840 Oh, okay. 185 00:10:14,840 --> 00:10:17,600 I need to take a break and watch one of these. 186 00:10:17,630 --> 00:10:18,410 That would be nice. 187 00:10:18,410 --> 00:10:22,190 With some peppermint ice cream and pretzels and not celery. 188 00:10:22,190 --> 00:10:23,330 I don't like celery at all. 189 00:10:23,330 --> 00:10:23,900 Really? 190 00:10:24,080 --> 00:10:24,770 Bye bye.