1
00:00:00,240 --> 00:00:06,360
Aliases we've written so far have been simple, there's what three of them, and we have not worked

2
00:00:06,360 --> 00:00:09,750
with any arguments, we haven't passed any additional values to them.

3
00:00:09,750 --> 00:00:16,170
For example, when we run get French, often we'll create a new branch instead of just looking at all

4
00:00:16,170 --> 00:00:16,590
branches.

5
00:00:16,590 --> 00:00:19,470
If we do get branch and then a branch name, it creates the branch.

6
00:00:19,830 --> 00:00:21,660
That would be an argument of value.

7
00:00:21,690 --> 00:00:25,680
We're passing to the command or get committed.

8
00:00:26,040 --> 00:00:28,950
If we do them, we provide a commit message.

9
00:00:29,610 --> 00:00:32,640
So how can I set up an alias, for example?

10
00:00:33,120 --> 00:00:39,990
Let's say I just want see or maybe s.m for commit with a message so I could write that alias myself.

11
00:00:40,890 --> 00:00:43,470
s.M equals commit Dasch m.

12
00:00:43,980 --> 00:00:46,410
But then what about the message itself?

13
00:00:47,010 --> 00:00:52,890
Well, the way that get aliases are set up, the way they're structured is that it will actually take

14
00:00:52,890 --> 00:01:00,030
any arguments we pass to whatever our aliases, this command, if we pass something like first commit

15
00:01:00,690 --> 00:01:04,890
for example, it will take that and pass it through here.

16
00:01:05,100 --> 00:01:06,990
So it will just append it to the end.

17
00:01:07,530 --> 00:01:10,140
So if we have two arguments that we pass through.

18
00:01:11,370 --> 00:01:16,140
For whatever reason, it wouldn't make sense here, but if we did get would pass both of them in that

19
00:01:16,140 --> 00:01:16,810
same order.

20
00:01:17,310 --> 00:01:22,140
So this makes it really, really easy to define aliases that involve arguments.

21
00:01:22,140 --> 00:01:28,260
We can do a lot more complex things, for example, s.m if we want that for commit message.

22
00:01:28,480 --> 00:01:33,150
So I wouldn't just do see, because sometimes, you know, a lot of the time you need to write full,

23
00:01:33,150 --> 00:01:38,340
commit messages, open it up in the editor multiple lines, follow a particular format template for

24
00:01:38,340 --> 00:01:38,890
your message.

25
00:01:39,300 --> 00:01:43,010
So I would do see them as the shortcut for Dash.

26
00:01:44,160 --> 00:01:48,640
So if I just do that and I save, do I have any changes in here?

27
00:01:48,690 --> 00:01:55,950
Let's do our get out or rather s I don't have anything to commit to, so let's just make a new file.

28
00:01:56,640 --> 00:01:59,160
Let's do touch new jazz.

29
00:01:59,520 --> 00:02:00,060
All right.

30
00:02:00,330 --> 00:02:04,880
And then just get as again we can add new jazz.

31
00:02:04,890 --> 00:02:06,300
We didn't set up an alias for that.

32
00:02:06,990 --> 00:02:12,690
And now I can do get s.m and then a message like my new commit.

33
00:02:13,690 --> 00:02:14,200
All right.

34
00:02:15,020 --> 00:02:20,680
Oh, I totally forgot not to use exclamation points in the terminal, and if we take a look, get l

35
00:02:20,920 --> 00:02:23,980
forget log, we see my new comet.

36
00:02:24,340 --> 00:02:30,340
So we successfully made a new comet using s.m so we could do another example.

37
00:02:31,450 --> 00:02:34,180
Get add there's another one, right.

38
00:02:34,180 --> 00:02:42,220
We add files, we could just do a equals add and I can add as many arguments after, you know, file

39
00:02:42,220 --> 00:02:43,390
one file too.

40
00:02:43,930 --> 00:02:45,580
They all will be included.

41
00:02:45,580 --> 00:02:49,960
They'll be passed through when I do get a they'll be password to get add.

42
00:02:50,980 --> 00:02:51,910
So let's try that.

43
00:02:52,390 --> 00:02:55,480
Here is the repository I'm working on.

44
00:02:55,510 --> 00:03:03,010
Let's just add some changes to this read me file and to this JS file and to our package JSON.

45
00:03:03,010 --> 00:03:06,600
I'm really destroying things, but should we change in here?

46
00:03:06,790 --> 00:03:07,530
Maybe a version.

47
00:03:07,540 --> 00:03:09,250
No, it doesn't matter.

48
00:03:09,250 --> 00:03:10,600
I'm just making a lot of changes.

49
00:03:11,570 --> 00:03:19,270
OK, so if I get X now instead of status, why not use our new alias if I want to add two of them,

50
00:03:19,280 --> 00:03:24,710
the read Me and New Jersey, I can do get a and then read me and new.

51
00:03:25,700 --> 00:03:27,550
Now, this only saves us two characters, right?

52
00:03:27,800 --> 00:03:29,290
It's not that long of a command.

53
00:03:29,900 --> 00:03:34,570
None of these are saving us a lot, although, you know, it's annoying to do like commit Desh AM.

54
00:03:35,000 --> 00:03:39,950
But I'm going to show you in the next video some more complicated commands or aliases that people like

55
00:03:39,950 --> 00:03:41,870
to use that will to steal.

56
00:03:42,170 --> 00:03:44,990
Well, they're shared for us to use, so we will borrow.

57
00:03:45,950 --> 00:03:47,300
But let me just demonstrate this.

58
00:03:48,580 --> 00:03:55,060
So get a with these two arguments, they both were passed through those two values to get at, and if

59
00:03:55,060 --> 00:03:58,000
we take a look at our status, both of them are ready to be committed.

60
00:03:58,360 --> 00:04:04,420
And now we can do it with a message, you know, another commit yay!

61
00:04:05,380 --> 00:04:10,110
And you get L and there we are, another commit yet.

62
00:04:10,960 --> 00:04:13,600
OK, so you don't really have to worry about arguments.

63
00:04:13,600 --> 00:04:15,100
You don't have to do anything fancy.

64
00:04:15,490 --> 00:04:19,240
They're automatically passed through when you define an alias and call it.
