Check out a free preview of the full Complete Intro to React, v9 course

The "Git" Lesson is part of the full, Complete Intro to React, v9 course featured in this preview video. Here's what you'd learn in this lesson:

Brian creates a .gitignore file to omit files and directories from a git repository. Git will track the history of any file in the project, and ignoring files that aren't related to the project or that are third-party modules authored by other developers will speed up the editor and reduce the files in the repository.

Preview
Close

Transcript from the "Git" Lesson

[00:00:00]
>> Brian Holt: Mostly I want you to do a gitignore at this point in the course, so Git is obviously our source tracking for our project, and mostly I just want you to make a gitignore file for stuff. This will really help out VS code to be faster for just a bunch of stuff, because VS code relies heavily on your gitignore being useful, and I just want you to like, it's good.

[00:00:24]
All of my projects, even if they're not making it to GitHub, I still have a habit of committing, and tracking, and all that kinda stuff. And most stuff ends up on Git, I have so much private garbage on GitHub anyway. So anyway, the first thing that you always ignore in your gitignore, especially if you're under Mac and especially if you're not on a Mac, is DS_ Store.

[00:00:46]
This shows up in so many projects, it's hilarious, it's a file that's auto-generated by Mac OS and it's all as far as I know. So if you like, just like drag a file here, it's the positioning in the Mac OS Window, and that's why it's in DS_ Store.

[00:01:03]
It might be other stuff too, but anyway, that's why DS_ Store ends up in every file. Node_ modules that should also be one that you immediately ignore, right? Because this is stuff that you don't wanna check in, you just wanna NPM install it every single time. Do we have a dist in this?

[00:01:18]
I can't remember, but we'll just copy, be what I have in here, dist, do we have dot, I don't remember either, but .env files, you always wanna ignore those. Coverage, we will have one of those, you can ignore the .vscode or not. That's up to you, I tend to ignore it, so the .vscode directory is like if you wanna make configurations specifically for your project.

[00:01:40]
When you when you open it, it'll generate this .vscode directory, it's up to you, if you want to check that in or not. If you think that's useful to share with your coworkers, then check it in. Sometimes it is, I can think of an example like it's a Python project, you want to make sure that everyone's using Pylance with your dot, with your project, right?

[00:01:59]
You would have a .DScode directory that would tell their projects, please install Pylands for them right up to you.
>> Brian Holt: Yep, and if you need more instruction on this, Primeagen definitely has a course, right? Yep, everything you know about Git.
>> Student: And also Nino's.
>> Brian Holt: Ninas is also great too, yeah, I hired Nina at Reddit, we have worked together for a long time, and then we worked together again at Microsoft.

[00:02:26]
The last thing we'll do is run, git init, it might yell at you, no, it's fine. Okay, so this will initiate an empty git project, even though I'm inside of my Git project, it's kind of an onion. It goes to the nearest git project in there, and you can see here, I have a .git directory.

[00:02:50]
So, that's kind of up to you, if you wanna just track it as part of my repo that you were in, right? Because I'm just in the, complete and short of reaction, v9 projects, right? And I have Padre Genos in here, or if you want to have your own separate this is my repo that I built, you can get in it in there, and you can track it as part of that.

[00:03:09]
That's totally up to you.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now