All right, let's talk GET. GET is a version control system. It keeps track of the changes made to your files, which makes collaboration a breeze. Two devs can work on the same project without stepping on each other's toes.
And if one of them had this, uh-oh, I think I messed up moment, GET makes it super easy to fix. Now, let's set up GET. But first, a quick check. Do you already have GET installed on your machine?
Open your terminal and type get dash dash version. I got it installed here. If you don't, no worries. Head over to get dash scm dot com forward slash downloads and grab it.
Take your time, I'll wait for you. Just kidding, pause the video and come back when you're done. Now, let's set up your GET's username and email address. In your terminal, type get config dash dash global user dot name and then your name.
Then do the same for your email. Okay, so let's navigate to the project's main directory in the terminal. And so far, it's just the code base on our machine. And here comes the magic spell, get init dash b main.
This initializes a new get repository for your project and creates a branch called main. A get repository, or repo for short, is where get keeps track of your project files and all the changes made to them. And the main branch we just created is like a container and it should have the main stable version of our project. And probably it's the one that you're going to be using in production.
And right now this container or branch is empty. We haven't yet added any files to it. We just created a branch called main. Now let's put the project files into this main branch.
To do that, we first have to put them in a special area called staging. Use the command get add dot, and the dot here represents everything in the current directory. With this, we staged everything, so everything now is prepared to be added to the main branch. But we don't just add them to the branch.
It has to be done in a certain way that would allow us to keep track and identify our changes over time. And the way we do that is by committing those changes. To create this comet, type get comet dash m, and then the message. I will call it init.
Cool, but what is a commit? Well, a commit is like telling Get to merge the files that we staged with the files in the branch that we ran, which is in our case, the main branch, and it doesn't have files yet. So we're just getting all the files inside it. And now our changes are merged, but at the same time, it will preserve the state of the branch before and after the changes.
So if we change something in a file, stage it, then comment the changes, it will update the main branch with the file changes. But at the same time, we still have control to undo the changes. Right, so all the time we're working in a local repository, we need to host our repo on GitHub. To do that, we must take a quick detour.
com and sign up for a free GitHub account, if you haven't already, and make sure to verify your email address afterwards. Next, let's get back to the terminal and create a special key that lets you securely connect your computer with GitHub. This might sound a bit complicated, but don't panic, it's fairly easy. ssh.
This will show us if we already have an SSH key. It should look like this one. If not, we'll generate one. All right, so let's copy the command to create a new key from the GitHub documentation.
com. and then I'll look for SSH, the first result generating a new key and let's scroll down and here it is. Copy that to the terminal and enter, enter again and enter one last time and there you go. Let's take a look at the SSH folder again and this is the file, this is the new key that we created.
Cool, so let's now copy the content of this file, pbcopy and then the path to the file. We are almost there. Now, head to your GitHub settings, and under the Access section, you should find SSH Settings, and then you should click on New SSH Key, and you can name it whatever you want. I'll call it Masterclass, and then you should paste the key inside this key field.
Finally, press Add SSH Key, and now your machine is connected with GitHub. Next step is to create a repository on GitHub. I'll just zoom in a little bit first, and then I'll click on the plus sign on the nav bar and choose New Repository. Scroll down and then choose a name for the repository.
js Masterclass, Twenty Twenty Four Edition. Scroll all the way down and click on Create Repository. And this will create a repository for us. Now, copy the SSH URL, go back to the terminal, and type get remote add origin, and then paste the URL.
And this will allow us to tell get push things to the origin. And by the origin, it means that it will push it to this URL. Okay, now let's finally push this main branch to the remote repository. We'll do that by typing get push and then dash u origin main.
Congratulations, now your GitHub repository is updated with your local branch. If you don't believe me, head back to GitHub, refresh the page, and you should see all the files inside the main branch. From here on out, the process is smooth sailing. Whenever you make changes and you want to update your Remit repository, this is usually gonna happen by the end of each lesson, simply use these three commands.
get add dash a to stage all the changes and to commit the stage files, you just type get commit dash m and then the message. And after you committed the changes, just push to the origin main. So get push origin main. And that's it.
I know that it can be confusing at first, but believe me, it gets easier with time. And remember, these commands are in the description for your reference. If you have trouble with anything, let me know in the comments. And now we are a hundred percent ready to kick off the project.