Check out a free preview of the full Complete Intro to Web Development, v2 course:
The "Using GitHub" Lesson is part of the full, Complete Intro to Web Development, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Brian shows GitHub, which is a centralized repository for git projects that allows developers across the world to collaborate on code.

Get Free Access Now

Transcript from the "Using GitHub" Lesson

>> Brian Holt: And now I have this really cool calculator project I wanna share with the world. So what I'm gonna do is I'm gonna go to GitHub.
>> Brian Holt: To me it's gonna take me directly to a logged in page because I have logged into my GitHub account. But you should sign up for Git if you have not already, GitHub.

[00:00:16] Just so you know what that looks like. I'm gonna open this in a anonymous browser. And this is what it looks like, you should pick a username and have an email, etc, etc. Once you get here, I want you to click the plus sign up here and say, New Repository, okay?

>> Brian Holt: And we're gonna call it the fpm-example, Frontend Masters, and this is an example.
>> Brian Holt: Okay, I'm gonna create a public repository.
>> Brian Holt: As for the intro to web dev.
>> Brian Holt: Okay, public repository. I'm going to ignore the README. You have to be a premium member to get private repositories, but don't be afraid of putting public repositories out that are garbage.

[00:01:07] If you look at mine, I have 100 repos and above, 75 of them are garbage. So that's fine, it's okay. Yeah?
>> Speaker 2: So, how do someone going into your GitHub account. That's wanting to offer you a job, potential and flare, how do the model through the garbage versus what's actually good?

>> Brian Holt: I think people would have different opinions on it. So you have pin repositories. So if you go to my like page right here.
>> Brian Holt: This is my profile page. Look at that beautiful smile. [LAUGH] These are the ones that I'm more proud of. So these ones I've pinned to my repository.

[00:01:49] Anything else is like I have, you have no guarantees that it's gonna be anything good.
>> Brian Holt: Okay, so I'm gonna say create a repository, I'm not gonna check that. So I'm gonna create this repository. Repository is like one atomic project. So that's what they call them, is repositories, or repos, often, okay?

>> Brian Holt: Here, what I'm gonna do, is I'm gonna come here, and I'm just going to copy this command right here.
>> Brian Holt: It doesn't get in remote at origin git, so a remote is, Git is decentralized. So if you and I were working on the same project, in theory we don't have to go through a server.

[00:02:30] I could push to your computer. Most people don't use it like that, most people have a centralized place to put their code. But you don't necessarily have to. That's why there's this concept of remote, it's because you could have multiple people and your all push in to each other and stuff like that, it's just not very common, okay?

[00:02:46] So git remote at origin, then I'm gonna add this URL right there.
>> Brian Holt: And I'm gonna say that, okay? So now if I say git remote -vv, you can see that I have this new remote to push to, so it's a place to push my code.
>> Brian Holt: So what I'm gonna do now is cuz I have commits to push, right?

[00:03:12] I'm gonna say git push origin master. Master is the name of the branch. If you wanna learn more about branching and stuff like that, definitely go check out Nina's course or read another tutorial on this. But right now we haven't branched off with anything and the default name of the branch is Master.

[00:03:30] It's the master branch, right? It's the overall master of the project. So I'm gonna say git push origin master, and its gonna take my code and push it up to GitHub. So now, if you go here and refresh the page, you can see that I have this repo.

[00:03:46] And you can click in here and you see my calculator.js and all that kinda stuff.
>> Brian Holt: So definitely keep all of your code on GitHub, I do for sure. It's really nice because if I ever lose my laptop, which I have done before, I can get it off GitHub.

[00:04:03] If I wanna like collaborate with you, you can click up here and fork. Which is the name of like, I'm interested in modifying your code for my purposes or I wanna improve your codes so that I can use it or things like that. You fork it so that you can modify, because you can't come in and change my code, you have to ask me to change my code.

[00:04:23] But if you fork it, you can modify your own copy of it. That's what forking is. You can also come in here and star it, which is like a social feature. I think this is neat, star, right? And then you can watch it as well which is a way of like if you're interested in like the progress of a repo, you can watch it.

[00:04:40] It will give you notifications.
>> Brian Holt: Make sense? So I would say this is like the modern programmers resume, is what their GitHub looks like.
>> Brian Holt: Okay.
>> Brian Holt: Pull request. So let's say I find a bug, right? For example, you find a typo with this particular course on this course website, which there are a lot, I've seen them.

[00:05:13] [LAUGH] If you go to mygithub/bthold/intrawebdevv2, that's where all of the code for this particular website lives. It lives here, right? So if you come in here as like, hey this is broken, you can even see here. People have been opening pull requests today. Thank you to the people who have been opening pull requests.

[00:05:35] So if I click on here and I say, fix typos on line 64. Good person. So I can see that Brandon, thanks Brandon. Notice that these edits might be needing makes here. So he fixed some of the repos, so I can actually go in here and see the commits that he has made.

[00:05:53] So I can go here and see what is changed. So here I said image instead of imagine, so he fixed that cuz he read my mind. And I'm pretty sure three has two Hs, Brandon. So I'll let it slide this time but, yeah. So obviously these are useful things, I should fix these.

[00:06:13] So what I'm gonna do right now is I'm gonna come over here and I'm just gonna say merge pull request, because his code is valid and it should be in the repo. So I said merge pull request and confirm merge.
>> Brian Holt: Now, my repo is updated with his changes, it's all merged together.

[00:06:29] And I'm gonna say thank you.
>> Speaker 2: [LAUGH]
>> Brian Holt: I can spell.
>> Brian Holt: So that's how the process works for incorporating new code, right? So what he did is he forked it, he modified it and he opened what's called the pull request. And then I looked at his pull request and I merged it into my code.

>> Speaker 3: Does he work with you or is that just for fun?
>> Brian Holt: He's just a nice person, I've never met Brandon.
>> Speaker 3: He's a first time contributor.
>> Brian Holt: To this repo. Yeah [LAUGH].
>> Brian Holt: So, really cool right though? It's collaborative, we get to make all this stuff together.

[00:07:10] And there's just nice people out there doing things because they're nice people.
>> Brian Holt: But that's the promise of Open Source, right? Like I'm putting all this stuff out there for free and in return people make it better for me. So that's kinda of your reward for putting stuff out there for free.

[00:07:29] It's because other people get to see, it's okay, if you do it this way, it gets better. In fact, I put out a little thing here called, if I go back to my profile.
>> Brian Holt: Called post CSS color blind, which is a little repo for changing your website to see whether a color blind person would see your website, right?

[00:07:51] So down here you can see example of here is how your CSS would look if you are normal seeing person. This is what it would look like if you had this particular disability. And here is what it would like if you can't see any color, right? So this was something I threw together on a weekend because I was curious if I could do it, really cool.

[00:08:12] And then, I just got busy and I couldn't update it. There's an awesome guy named Ben Briggs who works on post CSS, itself. And he came in and fixed all of my stuff for me, and opened a giant pull request, and fixed everything, right? So these kinda things happen like if you invest in a community, the community invest in you, which I think it's really cool.

>> Brian Holt: In particular I think the JavaScript community is pretty friendly. So it's something that's you should definitely try and get into. And don't have a lot of fear, just go out and open pull requests and sometimes they'll say hey, if you fix this then I'll merge it. Or sometimes they'll say, I'm not going in this direction, so thanks for opening it but I'm going this way.

[00:08:53] Or you can see here if you go back to my other repo.
>> Brian Holt: People open issues, so this person says hey, I'm getting a lot of issues. I'm seeing these kinda things and I can come down here and say, maybe try this, right? So that's what issues are, they're just saying, hey, I don't know why this is working or this is broken or maybe you should add this feature.

[00:09:15] It's kind of collaboration on the future of your projects. So GitHub is great. You should definitely get in on it. It doesn't, I mean there's also GitLab, there's also Bitbucket, there are several places you can put your code. There's Visual Studios Team Services which is the Microsoft version of it as well, so.

>> Speaker 3: I have a quick question.
>> Brian Holt: Sure.
>> Speaker 3: So with all this, how it's open sourced, it's really nice because then everyone can get together and work on something. But with the ability to fork it, what's to stop somebody, what if I work on something for ten hours, okay?

[00:09:56] And I put it on GitHub and I'm really proud of it and gonna show it to a future boss maybe. What's to stop somebody from forking it and being like ha ha, this is mine, I did this?
>> Brian Holt: The answer to your question is nothing, but there are kind of things you can do to put in place.

[00:10:13] So for example, something that I do if you come here to intro to web dev and you look here. I did put license on this, so you can put legal license to your project. This one in particular is attribution non-commercial. So I spent a ton of time on this particular course and it would be really crappy if someone else made a lot of money off of it.

[00:10:36] So this code and this content you can share for free forever to everyone. But if you make money off of it, I can sue you, right? So you can attach license to things, so that's your retribution. Most people, so the code that I have on this, so the content is licensed differently than the code.

[00:10:55] The code is Apache 2.0 and that's, you can modify this, you can say that I wrote this, I don't care. I actually really don't care. I spent a bunch of time on writing the code but that's not the important part to me. So for the most part, all the codes that I put out into the world, you are free to fork, bastardize, claim, make money off of all these things are fine.

[00:11:15] The only thing you can't do is sue me. [LAUGH] And that's what these license provide for you. So then I wanna answer that your question in multiple ways. It's you can't do things to prevent people from forking your code. You can actually disable the Fork button on here as well, if you want to.

[00:11:29] They can still get it but,
>> Brian Holt: It's a sharing environment, right? So I make a lot of money at my job working on top of things that people have built, right? Like I work on Linux a ton, which is the work of a ton of people, and I don't pay them anything, right?

[00:11:48] So the only thing I can do to pay that community back is to release things that I do for free. So whenever I can I open source, cuz I believe in the community, I believe that it moves humanity forward. As cheezy as that sounds. Does that answer your question?

>> Brian Holt: Other questions?
>> Speaker 4: How do you go about getting a license?
>> Brian Holt: You can go to, which is also from GitHub, they put up this website. I want simple permissive, it's gonna give you the MIT license. If I'm concerned about patents which is, I always do this one, personally Apache 2.0.

[00:12:33] And I care about sharing. So you might be more interested in something like this, which is you can fork this and you can modify it but you have to open source anything you do. Legally you have to open source it. You can close source anything with mine, so that's why I always choose Apache 2.0.

[00:12:49] But if you Fork Bash for example, which is what we've been using, you're actually legally obligated to open source any changes you make. I'm not a lawyer so do not take any advice from me whatsoever, but that is my understanding thereof.
>> Brian Holt: There's more choices down here if you're interested.

[00:13:10] But these are kind of the three common ones that I see. I don't actually really see very many people do copyleft, which is what you would call this. I see most people do MIT, and I think Apache is a superior license, so I personally choose that, but MIT is far more common.