1 00:00:07,440 --> 00:00:10,890 - All right, so here I am on the Git website 2 00:00:10,890 --> 00:00:13,833 and let's create this lesson 18 lab. 3 00:00:18,930 --> 00:00:20,493 Creating the repository. 4 00:00:21,510 --> 00:00:22,830 There we go. 5 00:00:22,830 --> 00:00:25,860 Now the easiest way is just to copy/paste all of this 6 00:00:25,860 --> 00:00:28,173 and let's go to Linux so that we can do that. 7 00:00:33,300 --> 00:00:36,693 So I'm mkdir lesson18lab. 8 00:00:38,940 --> 00:00:41,640 Not forget to get into it. 9 00:00:41,640 --> 00:00:43,620 Then I'm pasting all these commands 10 00:00:43,620 --> 00:00:44,913 that were created for me. 11 00:00:46,170 --> 00:00:47,670 Good. 12 00:00:47,670 --> 00:00:51,977 Let me create a couple of files for I in, 1..10. 13 00:00:55,050 --> 00:00:55,883 Do. 14 00:00:58,860 --> 00:01:02,737 Echo $I greater than 15 00:01:02,737 --> 00:01:06,753 $I dot txt, done. 16 00:01:08,130 --> 00:01:11,940 The result is that I have a couple of files that I can use 17 00:01:11,940 --> 00:01:14,883 in my testing and they contain some text as well. 18 00:01:16,040 --> 00:01:18,510 In git tests, I don't like empty files 19 00:01:18,510 --> 00:01:21,512 because empty files by git might be considered 20 00:01:21,512 --> 00:01:23,472 as files with the same content 21 00:01:23,472 --> 00:01:25,151 and that can lead to weird behavior. 22 00:01:25,151 --> 00:01:26,743 I don't want that to happen. 23 00:01:26,743 --> 00:01:30,390 So we are good, and we should be able to continue. 24 00:01:30,390 --> 00:01:31,380 Almost. 25 00:01:31,380 --> 00:01:35,190 First I need git add star to add these nice files. 26 00:01:35,190 --> 00:01:40,073 Git commit minus M, adding nice files, 27 00:01:41,790 --> 00:01:43,050 and then we are good. 28 00:01:43,050 --> 00:01:46,623 And now I can do my git branch testing. 29 00:01:48,930 --> 00:01:53,930 To create a branch, git checkout, testing. 30 00:01:54,210 --> 00:01:55,500 To start using it. 31 00:01:55,500 --> 00:01:57,393 So we switched to the branch testing, 32 00:01:58,878 --> 00:02:03,878 and let me use touch ABC to four dots txt. 33 00:02:08,940 --> 00:02:11,103 Oops, that was a mistake of course. 34 00:02:12,236 --> 00:02:17,236 Echo ABC and echo DEF to five dot txt. 35 00:02:23,250 --> 00:02:25,890 Verifying and you can see that the new files 36 00:02:25,890 --> 00:02:27,483 actually exist. 37 00:02:28,350 --> 00:02:32,400 Now I wanna make sure that this five dot txt 38 00:02:32,400 --> 00:02:34,560 is not going to be synchronized 39 00:02:34,560 --> 00:02:36,420 and in order to do so 40 00:02:36,420 --> 00:02:39,333 I am creating dot git ignore. 41 00:02:40,530 --> 00:02:42,150 And in this dot git ignore 42 00:02:42,150 --> 00:02:44,800 I'm listing five dot txt 43 00:02:48,510 --> 00:02:51,213 Next, git add star. 44 00:02:52,800 --> 00:02:56,010 And you can see the following is ignored. 45 00:02:56,010 --> 00:02:57,480 Five dot txt is ignored. 46 00:02:57,480 --> 00:02:59,430 Well that is exactly what you wanted, right? 47 00:02:59,430 --> 00:03:03,480 So git commit minus M four. 48 00:03:07,020 --> 00:03:12,020 And git push minus, minus set upstream 49 00:03:15,630 --> 00:03:17,193 origin testing. 50 00:03:18,750 --> 00:03:21,450 And that makes sure that the new files are pushed 51 00:03:21,450 --> 00:03:24,060 to the git repository in the new branch. 52 00:03:24,060 --> 00:03:26,910 This git push setup stream is actually very important 53 00:03:26,910 --> 00:03:29,700 because it makes my branch is becoming known 54 00:03:29,700 --> 00:03:32,910 to the people I'm working with on git. 55 00:03:32,910 --> 00:03:34,990 So now I'm using git checkout main 56 00:03:39,660 --> 00:03:41,853 and I'm using LS to verify. 57 00:03:42,990 --> 00:03:46,923 And you can see we do have to file five dot txt. 58 00:03:47,870 --> 00:03:49,899 That's because of the dot git ignore. 59 00:03:49,899 --> 00:03:52,648 It doesn't play ball as far as git is concerned. 60 00:03:52,648 --> 00:03:55,428 But we don't have the file four dot txt 61 00:03:55,428 --> 00:03:56,790 and that's what we are going to fix now 62 00:03:57,755 --> 00:04:00,240 by using git merge testing. 63 00:04:00,240 --> 00:04:03,810 Of course you're free to do a git-diff before you do so. 64 00:04:03,810 --> 00:04:05,130 Now let's use LS. 65 00:04:05,130 --> 00:04:07,560 And now we can see four dot txt again. 66 00:04:07,560 --> 00:04:10,830 Now what is git status saying about it? 67 00:04:10,830 --> 00:04:13,740 It's telling us that we should use git push 68 00:04:13,740 --> 00:04:16,800 because right now the local branch is ahead 69 00:04:16,800 --> 00:04:18,570 of origin main by two commits. 70 00:04:18,570 --> 00:04:19,620 That's not good. 71 00:04:19,620 --> 00:04:23,043 So we want git push to make sure that is synchronized. 72 00:04:24,420 --> 00:04:28,053 And now git status to verify and we can see 73 00:04:28,053 --> 00:04:31,680 that the local branch is up to date with origin main. 74 00:04:31,680 --> 00:04:32,513 And that's it.