Placeholder Image

Subtitles section Play video

  • (bell dings)

  • - Okay, so, I have a whole playlist of videos

  • about Git and GitHub if you haven't,

  • if you don't know anything about Git and GitHub

  • you might want to go and look at some of those

  • as we'll assume basic knowledge.

  • What I'm going to show you is,

  • if you're on a new machine,

  • hopefully you might have set this up already,

  • but what if right now, for the first time,

  • you are using Git from the command line

  • and you also want to work with GitHub.

  • So I've actually already installed Git.

  • I can see that,

  • because I can type Git and it shows me a bunch of things,

  • it doesn't say Git is unknown,

  • but if you need to install Git,

  • you can just go to git-sem

  • and download the latest version for your

  • operating system and then back here.

  • I got all this crazy stuff open, let me close it.

  • I can start doing git commands,

  • like for example, if I make a directory,

  • that's make a directory, like new project

  • and I do cd new project and I say git init

  • that's how it actually makes a git repository

  • inside of a folder.

  • Oh, look at this, all of the sudden it says

  • look, git and master and I can do things like

  • git branch and somethings I don't like to

  • use the word master, I just use source or something

  • so I can say git branch source.

  • Okay actually, I haven't made any files, so it's not

  • going to let me make a the branch without

  • any files, so let me show you, this is a bit out

  • of scope but it's fine actually because

  • we can tie some things together, like for example

  • I'm going to say code dot.

  • It will open up this directory with Visual

  • Studio Code, then I'm going to make a new file

  • and I'm going to call it

  • sketch dot js because I'm

  • working on some Java script code.

  • I'm just going to put function setup in it and

  • hit save and look at this when I come back here

  • you can see now that the file is in there,

  • and look at this actually this changed

  • I think this is indicating something to me

  • like there's a new file or something.

  • So now I want to say git commit but

  • guess what, who's making that commit.

  • I haven't actually configured my, if I'm working with

  • git locally on my machine, I actually need to

  • configure who I am.

  • One thing I can do is, is type git config dash list

  • I believe, and this is all the various settings

  • of things that are like set up

  • I don't really care about that,

  • I just hit Q to get out of that.

  • What I need to do, and I'm just going

  • to look this up with git config user dot name

  • or user email, or user name

  • and this can be my name or whatever name I want to use.

  • You should probably tie this to your GitHub account.

  • Oh no it needs to be global, git config user name,

  • I want it to be global, I think if I do dash dash global

  • then I can say git config user dot email and

  • Daniel at the coding train dot com

  • dash dash global.

  • So this now, I've now set up git by the way.

  • If it's a fresh install you're going to

  • want to do this, with my information and

  • then I can do things like, I can say git status

  • and this is like the new untracked file

  • so I can say git add sketch dot js

  • and then I can commit it and maybe

  • what I want to do is say.

  • You know most people would just do this

  • git commit dash M for a short message

  • like make a new file and I could do that

  • but I'm being very long winded in this video

  • so what I'm actually going to do

  • is configure my editor.

  • So what I'm going to look for is configure

  • code editor with git or associate, I think

  • is the word I'm looking for, associate.

  • If I come here, basically this is what I need

  • git config dash dash global core.

  • I want this and I'm using code

  • and I think it's good like

  • to put this dash dash wait, meaning

  • it will wait for you to finish and now if I say

  • just git commit, it opened up this thing

  • in my editor, which I can now write my commit message.

  • New file and I can write my longer one like

  • dear diary,

  • I don't know what I am doing with my

  • life,

  • all the best, sheefmahn.

  • Alright and then once I close it, back here it's

  • done that and I don't know why I'm talking

  • about git branches but I can say

  • git branch source

  • and that made a new branch

  • like I can say git branch and it will list me

  • and I can hit Q to get out of that.

  • Git branch dash V, it's showing me more

  • information and I can say git checkout

  • source and now I'm in the source branch.

  • This is so useful if you know again, if you're new

  • to git you might not realize this but

  • know which branch you're in all the time,

  • having that reminder is incredibly useful.

  • I should also mention if I go back into

  • Visual Studio Code and I do things like add something

  • you know, create canvas two hundred, two hundred

  • you can see here there's ways, here you can see right

  • here this one comes up, so this is also

  • Visual Studio Code knows about git and it's showing

  • you things like this one change and if I click on

  • this here it's kind of showing you this

  • is the new line of code, that is the current change.

  • You can actually do all of your git stuff from

  • within Visual Studio Code yourself but, I tend to

  • do it here, something that is a little tricky is if

  • you want to not have to always

  • type in your username or password for GitHub

  • if you're about to send your code to GitHub

  • there is a way to configure that through a

  • SSH key, I think it makes sense to do that

  • in a separate video if people are interested in that.

  • The instructions are actually pretty good

  • on the GitHub website, SSH key GitHub.

  • If I go to this, generating a new SSH key, I

  • always am just following this exactly,

  • and then associating it with a particular laptop

  • and then that computer is automatically

  • logged in, you should probably use a passphrase

  • when it asks you, empty for no passphrase,

  • to be more secure.

  • Okay alright, so next, next up working with nodes

  • Oh, we're almost done.

  • [Music Plays]

(bell dings)

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it