1
00:00:01,040 --> 00:00:02,890
[Autogenerated] So one aspect of improving

2
00:00:02,890 --> 00:00:05,080
your workflow with git revolves around

3
00:00:05,080 --> 00:00:06,840
automating things that normally take

4
00:00:06,840 --> 00:00:08,870
multiple steps. And we're going to

5
00:00:08,870 --> 00:00:10,730
leverage a feature of get, which is custom

6
00:00:10,730 --> 00:00:13,980
get commands to do just that. So over the

7
00:00:13,980 --> 00:00:15,390
course of this demo, here's what we're

8
00:00:15,390 --> 00:00:17,990
gonna be doing. First, we will be creating

9
00:00:17,990 --> 00:00:20,210
a directory to store custom commands for

10
00:00:20,210 --> 00:00:22,670
our user. Well, then, make sure that that

11
00:00:22,670 --> 00:00:25,200
directory is in the path variable. And

12
00:00:25,200 --> 00:00:27,250
then we will create a custom command that

13
00:00:27,250 --> 00:00:29,930
combines multiple get commands in tow one.

14
00:00:29,930 --> 00:00:32,000
And then ultimately we will run and verify

15
00:00:32,000 --> 00:00:35,350
our custom command. So first, we need to

16
00:00:35,350 --> 00:00:37,680
create a directory for our user to store

17
00:00:37,680 --> 00:00:40,270
our custom get commands. In this case,

18
00:00:40,270 --> 00:00:43,340
we're gonna call that get Dash scripts.

19
00:00:43,340 --> 00:00:45,260
Next will change into this directory.

20
00:00:45,260 --> 00:00:47,880
Next, we're going to add it a sample file.

21
00:00:47,880 --> 00:00:49,840
In this case, we'll just call this get

22
00:00:49,840 --> 00:00:52,370
dash test script and you'll notice that

23
00:00:52,370 --> 00:00:54,270
every command that we create needs to

24
00:00:54,270 --> 00:00:58,410
start with git and then dash. So inside of

25
00:00:58,410 --> 00:01:00,740
this file, we're just going to include an

26
00:01:00,740 --> 00:01:03,750
echo statement. This will allow us to test

27
00:01:03,750 --> 00:01:06,140
and make sure that this custom script is

28
00:01:06,140 --> 00:01:09,490
working next. We need to make sure that

29
00:01:09,490 --> 00:01:11,580
this file and any of our custom get

30
00:01:11,580 --> 00:01:14,780
commands are executed. Now from here, The

31
00:01:14,780 --> 00:01:17,080
next step is that we need to make sure

32
00:01:17,080 --> 00:01:19,750
that our get scripts directory is in the

33
00:01:19,750 --> 00:01:23,020
path variable for our user. So in this

34
00:01:23,020 --> 00:01:25,450
case for me, this is going to involve me

35
00:01:25,450 --> 00:01:28,050
putting this into my Z s h r c. Because

36
00:01:28,050 --> 00:01:30,140
I'm using I'm Dizzy s h as opposed to

37
00:01:30,140 --> 00:01:32,350
bash. Now, if you're using Bash, which is

38
00:01:32,350 --> 00:01:34,430
the default on Mac, you can simply run

39
00:01:34,430 --> 00:01:36,660
this and drop this into bash profile. Now,

40
00:01:36,660 --> 00:01:38,690
you will need to update this directory to

41
00:01:38,690 --> 00:01:41,940
be the specific directory for your user.

42
00:01:41,940 --> 00:01:45,110
I'll go ahead and put this back in, and

43
00:01:45,110 --> 00:01:48,040
then I'll hit. Enter now. The next step is

44
00:01:48,040 --> 00:01:51,240
I need to actually source this value, and

45
00:01:51,240 --> 00:01:53,200
this will actually pick up on that path.

46
00:01:53,200 --> 00:01:56,190
Variable. Now, next. If everything works

47
00:01:56,190 --> 00:01:59,270
properly, I should be able to run, get,

48
00:01:59,270 --> 00:02:01,530
and then pass in as the sub command the

49
00:02:01,530 --> 00:02:04,310
name of my custom command. So in this

50
00:02:04,310 --> 00:02:06,870
case, get and then test script. Now, as I

51
00:02:06,870 --> 00:02:09,440
mentioned, any get custom command in terms

52
00:02:09,440 --> 00:02:11,870
of the file needs to start with Get Dash

53
00:02:11,870 --> 00:02:14,090
and it will only work if this is on the

54
00:02:14,090 --> 00:02:17,010
path. And we can see here that we do see

55
00:02:17,010 --> 00:02:19,160
the echo statement indicating that the

56
00:02:19,160 --> 00:02:21,110
test script worked. So our custom get

57
00:02:21,110 --> 00:02:23,450
command is working just fine. But now

58
00:02:23,450 --> 00:02:25,150
we're gonna create one that we actually

59
00:02:25,150 --> 00:02:27,610
will use now, if you remember previously

60
00:02:27,610 --> 00:02:29,180
when we talked about working with sub

61
00:02:29,180 --> 00:02:31,460
modules, there were three different steps

62
00:02:31,460 --> 00:02:33,730
that we needed to integrate when we were

63
00:02:33,730 --> 00:02:35,550
looking to pull down commands for a

64
00:02:35,550 --> 00:02:37,960
depository that contains sub modules. In

65
00:02:37,960 --> 00:02:39,610
this case, we're goingto automate those

66
00:02:39,610 --> 00:02:42,490
steps into one custom get command, and in

67
00:02:42,490 --> 00:02:43,960
this case, we're going to call it, get

68
00:02:43,960 --> 00:02:46,070
some pool I'm going to paste. And what

69
00:02:46,070 --> 00:02:47,510
will be the logic that we will be

70
00:02:47,510 --> 00:02:49,980
automating for this particular custom? Get

71
00:02:49,980 --> 00:02:51,910
command. So first you'll notice that I'm

72
00:02:51,910 --> 00:02:54,680
using Bash, and then I'm going to call get

73
00:02:54,680 --> 00:02:56,790
pole. This will allow us to pull changes

74
00:02:56,790 --> 00:02:59,330
from the remote. Then I'm going to call

75
00:02:59,330 --> 00:03:02,210
get sub module sink recursive, and this is

76
00:03:02,210 --> 00:03:04,370
what will allow us to sink our config in

77
00:03:04,370 --> 00:03:06,550
the local repositories with any changes

78
00:03:06,550 --> 00:03:08,650
that have come in from one of our direct

79
00:03:08,650 --> 00:03:10,460
sub modules or any of the child's of

80
00:03:10,460 --> 00:03:12,640
modules. And then finally, we're going to

81
00:03:12,640 --> 00:03:14,840
call get sub module update and it

82
00:03:14,840 --> 00:03:16,910
recursive, which is what will update the

83
00:03:16,910 --> 00:03:18,840
sub modules to the correct commit. And if

84
00:03:18,840 --> 00:03:20,820
they haven't yet been initialized, it will

85
00:03:20,820 --> 00:03:22,980
initialize them. And we can perform all of

86
00:03:22,980 --> 00:03:24,970
those across the entire sub module tree

87
00:03:24,970 --> 00:03:28,630
Recursive Lee, I'll now save the file now

88
00:03:28,630 --> 00:03:30,520
from here, the next step is I need to make

89
00:03:30,520 --> 00:03:34,240
sure this particular file is executed.

90
00:03:34,240 --> 00:03:36,310
Next, I'm going to clone the same module

91
00:03:36,310 --> 00:03:38,400
that we leverage before that Integrated,

92
00:03:38,400 --> 00:03:40,880
get some modules. And next I'm going to

93
00:03:40,880 --> 00:03:43,470
change into that directory. Now that I'm

94
00:03:43,470 --> 00:03:45,830
in that directory, I'm going to now use

95
00:03:45,830 --> 00:03:50,240
our new custom, get command, get simple,

96
00:03:50,240 --> 00:03:51,890
and we can see that it has walked through

97
00:03:51,890 --> 00:03:58,000
each of the three different steps that we included within our custom Get command

