WEBVTT

1
00:00:00.000 --> 00:00:04.861
[MUSIC]

2
00:00:04.861 --> 00:00:09.487
In this stage, we'll go in depth with
some of GitHub's most essential features,

3
00:00:09.487 --> 00:00:13.460
issues using markdown,
branching, and pull requests.

4
00:00:13.460 --> 00:00:17.250
Used together, these features
are the backbone of open source on GitHub.

5
00:00:17.250 --> 00:00:19.660
And learning how to use them to
add your projects to the site,

6
00:00:19.660 --> 00:00:22.470
will be a great foundation to
both showcase your work, and

7
00:00:22.470 --> 00:00:24.400
start contributing to
the open source community.

8
00:00:25.510 --> 00:00:29.260
So, now that we've created a repository,
let's open our terminal and

9
00:00:29.260 --> 00:00:31.420
push up a project to GitHub.

10
00:00:31.420 --> 00:00:32.370
Quick review.

11
00:00:32.370 --> 00:00:36.480
When I say push, I'm talking about
the Git push command where we'll push our

12
00:00:36.480 --> 00:00:40.990
project on our local computer,
up to a remote repository on GitHub.

13
00:00:40.990 --> 00:00:44.850
Later, we'll talk about Git pull, where
we'll go over pulling the latest changes

14
00:00:44.850 --> 00:00:47.430
from a remote repository
down to our local computer.

15
00:00:47.430 --> 00:00:51.560
I want to push up the files from
the Treehouse Python course I recently

16
00:00:51.560 --> 00:00:55.430
finished, so I'm in my completed
Python Basics work space.

17
00:00:55.430 --> 00:00:59.580
You can follow along using a work space
for a course you've already completed, or

18
00:00:59.580 --> 00:01:01.740
if you have Git installed
on your local computer,

19
00:01:01.740 --> 00:01:04.140
you can use your computer's console.

20
00:01:04.140 --> 00:01:07.370
First, let's take care of
some Git configurations.

21
00:01:07.370 --> 00:01:11.230
I'll check the Git version
by typing git--version.

22
00:01:11.230 --> 00:01:14.710
Great, it looks like we have Git
installed, and we're on version 1.8.

23
00:01:14.710 --> 00:01:15.920
That's perfect.

24
00:01:15.920 --> 00:01:18.720
We can check to see if we have any
configurations already set up,

25
00:01:18.720 --> 00:01:21.564
by typing git config --list.

26
00:01:23.680 --> 00:01:24.620
Nope.

27
00:01:24.620 --> 00:01:27.630
Okay, so then we'll need to set
up our name and email address, so

28
00:01:27.630 --> 00:01:29.210
Git knows who we are.

29
00:01:29.210 --> 00:01:36.996
The commands for
this are git config --global user.name,

30
00:01:36.996 --> 00:01:43.591
your name in quotes, and
git config --global-.

31
00:01:46.686 --> 00:01:50.521
User.email and
your email address in quotes.

32
00:01:57.251 --> 00:02:02.100
Make sure the email you use is the email
associated with your GitHub account.

33
00:02:02.100 --> 00:02:04.580
These commands are also linked
in the teacher's notes.

34
00:02:04.580 --> 00:02:07.440
If using your local computer,
I've added some additional links for

35
00:02:07.440 --> 00:02:12.050
helpful command line configuration, for
maximum Git and GitHub effectiveness.

36
00:02:12.050 --> 00:02:14.710
Now, typically the name of
the local directory matches

37
00:02:14.710 --> 00:02:16.190
the remote repository's name.

38
00:02:16.190 --> 00:02:19.962
So, I'm gonna create a folder,
Treehouse, and move my files into it.

39
00:02:19.962 --> 00:02:24.120
I'll type mkdir Treehouse.

40
00:02:25.360 --> 00:02:28.730
This creates the directory, Treehouse.

41
00:02:28.730 --> 00:02:33.320
And I'll type mv,
which stands for move, *.py,

42
00:02:33.320 --> 00:02:39.470
which says everything with the .py
extension move to this directory.

43
00:02:42.100 --> 00:02:48.710
Now if I cd or change directory
into the Treehouse folder, and

44
00:02:48.710 --> 00:02:54.710
I ls list everything out, I can see my two
files are now in that folder structure.

45
00:02:54.710 --> 00:03:00.040
And if I'm using work spaces over here,
I can just click and refresh.

46
00:03:01.400 --> 00:03:04.960
I can see that the two files are also
under the Treehouse folder structure

47
00:03:04.960 --> 00:03:05.617
in work spaces.

48
00:03:06.840 --> 00:03:11.050
Next, we'll want to initialize the Git
repository, so we'll type git init.

49
00:03:12.470 --> 00:03:15.100
Initialized empty Git repository.

50
00:03:15.100 --> 00:03:15.610
Great.

51
00:03:15.610 --> 00:03:17.760
And then we'll type, git status.

52
00:03:20.410 --> 00:03:23.090
This lists out all
the files in the directory.

53
00:03:23.090 --> 00:03:24.880
Okay, let's read what it says.

54
00:03:24.880 --> 00:03:28.000
On branch master,
we're on the master branch, and

55
00:03:28.000 --> 00:03:32.260
this is because master is the default
branch to be on, so this is great.

56
00:03:32.260 --> 00:03:37.480
Un-tracked files, use git add,
to include what will be committed.

57
00:03:38.660 --> 00:03:42.300
So, I can type git add and
the file name, to add a single file.

58
00:03:42.300 --> 00:03:46.030
However, if we have multiple files
like we do, that can be a bit tedious.

59
00:03:46.030 --> 00:03:50.531
Instead, I'll use the shortcut git add .,
to add all the files in the directory.

60
00:03:54.151 --> 00:03:58.159
Next we'll commit, git commit -m and

61
00:03:58.159 --> 00:04:02.420
in quotes we'll type, initial commit.

62
00:04:03.890 --> 00:04:08.300
This commits all of the files and
the -m adds the message initial commit.

63
00:04:10.160 --> 00:04:14.130
Two files changed,
lumberjack and number_game.py.

64
00:04:14.130 --> 00:04:15.360
Great.

65
00:04:15.360 --> 00:04:17.491
Now, we'll add our remote
repository from GitHub.

66
00:04:22.291 --> 00:04:26.150
GitHub provides us a shortcut
with these commands we need here.

67
00:04:26.150 --> 00:04:29.271
We'll copy the first line,
and back in the terminal.

68
00:04:33.211 --> 00:04:34.110
We'll paste it in.

69
00:04:36.240 --> 00:04:38.740
This creates a remote,
or said differently,

70
00:04:38.740 --> 00:04:42.570
a connection named origin,
pointing to the GitHub repo.

71
00:04:42.570 --> 00:04:44.390
Now we'll push up our project.

72
00:04:44.390 --> 00:04:47.860
Type in git push origin master.

73
00:04:49.160 --> 00:04:52.860
This sends your commits in
your master branch to GitHub.

74
00:04:52.860 --> 00:04:54.760
You'll need to type in your user name and
password.

75
00:04:59.941 --> 00:05:03.253
If you're using your local computer, you
can use the link in the teachers notes,

76
00:05:03.253 --> 00:05:06.580
to cache your password so
you don't have to type it in every time.

77
00:05:06.580 --> 00:05:09.510
Congratulations, your
project is now on GitHub.

78
00:05:09.510 --> 00:05:13.140
To check it out, we'll refresh the page
and we can see all of our files.

79
00:05:13.140 --> 00:05:14.770
And if we click in, we can see the code.

80
00:05:16.850 --> 00:05:18.344
Okay, so to review,

81
00:05:18.344 --> 00:05:23.245
here are the commands we use to get
our local project hosted on GitHub.

82
00:05:23.245 --> 00:05:27.338
Git init, git status, git add.

83
00:05:27.338 --> 00:05:33.470
Git commit -m quote initial
commit git push origin master.

84
00:05:34.660 --> 00:05:37.320
If you are working by yourself and
pushing up projects,

85
00:05:37.320 --> 00:05:41.310
those last four commands will be
the ones you use over and over again.

86
00:05:41.310 --> 00:05:45.110
Memorize these, or write them down on
a sticky note where you can see them.

87
00:05:45.110 --> 00:05:48.570
Next up, we'll use issues to track
tasks related to our project.
