- 2 days ago
Take my Full Git and GitHub course: https://www.analystbuilder.com/courses/git-and-github-for-data-professionals
Git: https://git-scm.com/
GitHub: https://github.com/
____________________________________________
RESOURCES:
💻Analyst Builder - https://www.analystbuilder.com/
📖Take my Full MySQL Course Here: https://bit.ly/3tqOipr
📖Take my Full Python Course Here: https://bit.ly/48O581R
📖Practice Technical Interview Questions: https://bit.ly/46pDqqL
Coursera Courses:
Google Data Analyst Certification: https://coursera.pxf.io/5bBd62
Data Analysis with Python - https://coursera.pxf.io/BXY3Wy
IBM Data Analysis Specialization - https://coursera.pxf.io/AoYOdR
Tableau Data Visualization - https://coursera.pxf.io/MXYqaN
Udemy Courses:
Python for Data Science - https://bit.ly/3Z4A5K6
Statistics for Data Science - https://bit.ly/37jqDbq
SQL for Data Analysts (SSMS) - https://bit.ly/3fkqEij
Tableau A-Z - http://bit.ly/385lYvN
*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________
BECOME A MEMBER -
Want to support the channel? Consider becoming a member! I do Monthly Live
Git: https://git-scm.com/
GitHub: https://github.com/
____________________________________________
RESOURCES:
💻Analyst Builder - https://www.analystbuilder.com/
📖Take my Full MySQL Course Here: https://bit.ly/3tqOipr
📖Take my Full Python Course Here: https://bit.ly/48O581R
📖Practice Technical Interview Questions: https://bit.ly/46pDqqL
Coursera Courses:
Google Data Analyst Certification: https://coursera.pxf.io/5bBd62
Data Analysis with Python - https://coursera.pxf.io/BXY3Wy
IBM Data Analysis Specialization - https://coursera.pxf.io/AoYOdR
Tableau Data Visualization - https://coursera.pxf.io/MXYqaN
Udemy Courses:
Python for Data Science - https://bit.ly/3Z4A5K6
Statistics for Data Science - https://bit.ly/37jqDbq
SQL for Data Analysts (SSMS) - https://bit.ly/3fkqEij
Tableau A-Z - http://bit.ly/385lYvN
*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________
BECOME A MEMBER -
Want to support the channel? Consider becoming a member! I do Monthly Live
Category
📚
LearningTranscript
00:00What's going on everybody? Welcome back to another video.
00:02Today we're going to be learning Git and GitHub in under an hour.
00:11Now, if you were like me many years ago, I only knew what GitHub was.
00:15I just used it to toss projects into and link it to LinkedIn or maybe X for Twitter.
00:20I did not start using Git and GitHub professionally until about four years into being a data analyst.
00:25To be honest, I was very intimidated. I did not know anything about version control.
00:29It was very scary to me. Luckily, I had some good people on my team who were very patient with
00:34me,
00:34but it did take me a while to learn. And so hopefully in this lesson,
00:38you're going to learn Git and GitHub really well, very quickly.
00:41Now, what we're going to be doing in this video is we're going to start off by comparing Git and
00:45GitHub,
00:45because believe it or not, they are two completely separate tools.
00:48Next, we're going to install Git. We're going to spin up a repository.
00:51We're going to make some commits, and then we will be connecting that to GitHub.
00:54After that, we're going to kind of get into a full life cycle of what it's like actually using these
00:58tools.
00:58We will be connecting this to VS Code. I used that a lot when I was in my job,
01:03and I think it's a really popular IDE for people to use these tools with.
01:07I really hope you learn a ton in this video. If you want to dive even more in depth,
01:10I have a full course on Git and GitHub on my platform, analystbuilder.com.
01:14I will leave a link in the description. Without further ado,
01:17let's get started by taking a look at the difference between Git and GitHub.
01:20All right. So before we get into Git and GitHub,
01:23a really important concept to understand is version control. Now, version control
01:27control has a lot of depth to it, but I'm going to give you some of the basics of what
01:31version control
01:31is. The way that I look at version control is basically like a video game. You can have save
01:37points previously, and you can go back to those save points, and then you can play the game from
01:41there. And if you want to go back, you can. And that's kind of how version control works.
01:46It takes snapshots of changes you make, except instead of a video game, it's when you're coding.
01:51Say you're coding today, and you take a snapshot, and then in a week, you take another snapshot,
01:56and then another week, you take another snapshot. But then at the very end, you realize a while back,
02:00several weeks ago, you did something wrong, and you need to go back. Without version control,
02:05you may not be able to do that. You may not have saved your files appropriately. But with version
02:09control, you can just revert back to a previous snapshot, and then you can start working from there,
02:14and it's a really great system. So it takes snapshots of changes. You can view your history. So if you
02:20take
02:20lots of snapshots, you can go back, and you can see where you took those snapshots. You can also
02:26roll back your changes. So like I said, if you've been coding for a week, a month, a year, you
02:32can go
02:32back to any of those previous snapshots. The next thing to know is that version control systems allow
02:37for collaboration. Now, with Git, it's going to be on your local machine. But when we connect it to
02:43something like GitHub, then you'll be able to collaborate with a team. People can clone your repository.
02:49They can pull everything and all the changes that you've made in your GitHub. And it becomes a great
02:54way to share your code and collaborate with other people on your team. So with that being said,
02:58let's take a look at Git. So Git was created by Linus Torvalds. If you don't know who that is,
03:04he created the Linux operating system, which is pretty awesome. But he created Git because he was
03:09running into so many issues with something called BitKeeper, which is what the previous version
03:14control system was for Linux. And so Git introduced distributed version control, which allows lots of
03:19developers to work on a project simultaneously without conflicts. Again, one of the issues that
03:24BitKeeper had. The other biggest thing is that Git is really good at working with large projects and
03:31is really fast. And so if you have really large databases or really large code bases that you're
03:37working with, Git handles them extremely well. So that's who created it. That's kind of why it was
03:42created and a little bit about what it does. But let's take a look a little bit more into what
03:46Git
03:46really is. Git is a distributed version control system, a VCS. And like we talked about with
03:53version control systems at the very beginning, it allows you to track changes in your source code
03:57while you're developing things. Now, this was originally created for software development,
04:01but other teams use it too. When I was back on a data science team, we used Git and GitHub,
04:07and that was very common. So a lot of data science, data engineering, they will use
04:10Git and GitHub in their workflow. It's not just for software development anymore.
04:15It allows multiple developers to work on a project without overwriting each other's changes.
04:20And so what you have is you'll have this main branch that is kind of your source of truth.
04:24And then what you can do is Git allows you to branch off of that and basically code alongside
04:29that main branch. And then when you're done, you can merge it back into that main code base
04:34with reviews. And that way it doesn't overwrite someone else's code because you're not all coding
04:39on the same main branch. Why do people use Git specifically? Well, Git is one of the most
04:45popular version control software in the entire world. In fact, it comes pre-installed on Mac and
04:51Linux. It does not come pre-installed on Windows, but in the next lesson, I'll show you how to download
04:55that and get that set up. The other thing is that it's open source. Anybody can use it. Git is
05:00completely
05:01free to use. Just a local application that you can run and use. And honestly, it's quite easy
05:06once you get into it. The next thing is it has lots of documentation and support. I've run into
05:10issues when I've used Git and there's so much documentation on exactly how to fix these issues.
05:14It is insane. And so any issue that you could possibly have has most likely been encountered
05:19and you can just find out how to fix it online. And lastly, Git has integrations with almost all
05:25version control systems like Sourcetree, Heroku and GitHub most popularly, but you can integrate it
05:30with a ton of different applications. On this right hand side, this is kind of a workflow of
05:35Git. We'll be working through some of these things in this series where I show you how you can create
05:40a local repository, how you can create a remote repository, how you can work with those two
05:45together, how to add, commit and push, how to pull down your changes, how to push your changes,
05:50all these different things are things that we'll be looking at in this series. Next, let's take a look at
05:54GitHub. Now, believe it or not, Git and GitHub are not the same and they're not even owned by the
06:00same company. GitHub was founded in 2008 and quickly became one of the largest code host
06:05websites in the world and absolutely changed how coders and developers and data professionals
06:10collaborate and work on coding. It was acquired in 2018 by, you guessed it, Microsoft for over $7
06:17billion. So it gives you a little indication on kind of the value that GitHub was providing
06:22and the fact that Microsoft acquired it, which is one of the biggest tech companies in the world.
06:26GitHub is basically just a hosting website for Git. It adds some additional functionality,
06:32which makes using Git a lot easier. And so that's why so many people use it.
06:36But GitHub can also be free and you can host your open source projects and even private projects.
06:42But there is a paid version where larger teams can pay for it. It does get a bit pricey. For
06:47my team
06:47with Analyst Builder, we use GitHub and we have the paid version. It is pricey, but it is a very
06:52great
06:52service. So GitHub is basically a cloud-based platform to kind of connect to Git and store
06:58things in the cloud so you can access it anywhere in the world. If you're using a local Git repo,
07:03then you can only access that on your local machine. You can't access that if you go to another
07:07computer. So GitHub utilizes Git for their version control, which is how they track the changes and
07:13maintain the different versions of their code. So GitHub is basically built off of and utilizes Git.
07:18And GitHub really makes it easy for teams to work together because, like I said, you can pull
07:24down different changes, you can merge things, you can have code reviews, and you can do all that
07:28within GitHub. And it makes it really easy with a great user interface. So really quickly, let's just
07:32take a look at the difference between Git and GitHub. GitHub is a service, whereas Git is the actual
07:38software. GitHub basically just sits on top of it in the cloud and utilizes Git. GitHub is kind of the
07:44user interface, while Git is a command line tool. You're going to use it in the command line,
07:48and that might seem a little bit scary to you at first because maybe you've never done that before,
07:53but I'll show you how to do it. It's a lot easier than it sounds. Next is that GitHub is
07:57hosted on the
07:58web. It's a cloud-based service, whereas Git is stored locally on your machine. GitHub is maintained
08:04and owned by Microsoft, while Git is maintained and owned by Linux. Next, GitHub is focused on centralized
08:10source code hosting, while Git is focused on version control and code sharing. And lastly,
08:15GitHub is a host service for Git repositories, while Git is the version control system that
08:20manages your code history. I think this sums up, basically, I think it sums up perfectly kind of
08:24the differences between the two and where you're going to use them. Honestly, when you're working
08:28on a project on your local machine, you should be using Git for the most part. But then when you
08:33want
08:33to save and store and share all these different things, you're going to connect it to GitHub and then use
08:39that platform to kind of disperse, save and have that history of your code online.
08:44Hello, everybody. In this lesson, we're going to be downloading and setting up Git and GitHub.
08:48And so I'm going to show you how you can do both. And then in the next lesson, we're going
08:52to dive
08:53into Git. And then in future lessons, we'll be combining both Git and GitHub. And we should learn
08:58a ton in this series. Now, if you're already on Mac or Linux, go down and search and see if
09:05you already
09:05have Git pre-installed because Git should come pre-installed on both those operating systems.
09:09If for whatever reason you don't have it, you can install those here. But I'm on a Windows machine,
09:15so I'm going to download Windows because if you are on Windows, you will not have Git pre-installed
09:20at all. It just does not come pre-installed. So let's download for Windows. We're going to click
09:25here to download. Now we have to save this somewhere. I'm just going to go to my downloads
09:29and save this in here. There we go. Let's go ahead and save this. And there we go. There's
09:35our .exe file. Let's go ahead and click on it. So now we get this pop-up and this is
09:39the Git setup.
09:40And it's very, very simple. So let's just walk through it. Let's go ahead and click Next.
09:45We need to specify where we're going to keep this. I am going to keep this in my program files,
09:50so I don't need to change that location. Next, we need to select the components. Now,
09:55there are ones already pre-installed. If you are going to be using Git a ton, you can check for
10:00daily updates, but I'm not going to do that. I'm just going to go ahead and click Next.
10:04We can also create a shortcut if you want to access Git. I don't want this on my start menu,
10:10so I'm not going to do that. But if you want to, you can go ahead and have that.
10:14And let's click Next. This one is very important. Choose the default editor used by Git. Now,
10:19it says use Vim's the ubiquitous text editor as Git's default, but I don't recommend that at all.
10:26In fact, I'm going to switch mine to Visual Studio Code. That's going to be as Git's default editor.
10:31I believe if we go back to Vim really quick, I think it's up here. If we go back to
10:37Vim,
10:37I think it says, note Vim is the default editor for historical reasons and is highly recommended
10:42to switch to a modern GUI editor instead. I concur. Vim is great, but it's also very old.
10:51It's kind of an ancient tool, if you want to call it that. But I'm going to change my
10:54Visual Studio Code because that's what I use when I am coding. So we are going to use that.
10:59Let's go ahead and click on Next. Now we need to adjust the name of the initial branch
11:02of the new repository. Now, by default, it's going to call it Master, but that does potentially cause
11:09issues actually when you connect it with GitHub. And in fact, I prefer it being called Main.
11:15That's my personal preference. But we're going to keep it as Master because I will show you how
11:20you can just change the branch name once you get in there. But if I were doing this for myself,
11:25which I do use it myself, then I would just call it Main. But let's keep it as let Git
11:30decide.
11:31And we'll click Next. After this, we have to adjust our path environment. Now there are some different
11:35options and they could be a bit limiting depending on what you want to choose for your path. I
11:40recommend just using the Git from the command line and also from third-party software. That'll help us
11:44down the line just for simplicity purposes. So I'm going to keep it that and click Next. Next,
11:49we have to choose our secure shell client program. Which one would you like to use? And we're of course
11:54just going to use the bundled open SSH. If you want to use an external one and you know how
11:59to do it,
12:00then you can do that. But if not, just keep it with the default option.
12:03Next, we have to choose our HTTPS transport backend. If you have an open SSL library,
12:09you just need to kind of verify this and you'll need to make sure that that's set up properly.
12:14We're just going to use our native Windows secure channel library. That's already built in.
12:18Next, we have to configure the line ending conversions. We're going to check out the
12:22Windows style. I'm going to keep it for Windows because it just makes it easier and that's what I'm
12:26used to. Now we have to configure the terminal emulator to use with Git Bash. We're again,
12:31keeping it as the default option here. Now this one is quite important. It says,
12:35choose the default behavior of GitPull. Now GitPull is something that we will be looking at in this
12:40series. And when you write GitPull and you run it, what do you want it to do by default? Do
12:45you want
12:46to fast forward or merge? Rebase? Only ever fast forward. So there are different options that we
12:51can have. Now by default, it's fast forward and merge. So it says fast forward the current branch
12:56to the fetch branch when possible. Otherwise create a merge commit. You can also choose rebase,
13:01which it will rebase the current branch onto the fetch branch. If there are no local commits to
13:05rebase, this is equivalent of a fast forward or just use a fast forward. Now you guys, if you've
13:11never used Git, have no idea what this means, but I'll talk about some of this once we get to
13:15it,
13:15but we're going to keep it as fast forward or merge. Next, if you want, you can use a credential
13:20helper and I do recommend that. So we're going to keep it. You don't have to, you can just choose
13:25none. Let's go ahead and click next. It's asking us if we want to enable file system caching or
13:30enable symbolic links. You can do both or none. I'm just going to keep the first one as default.
13:36And now we can install Git on our local machine. It should be very, very quick. Git is a very
13:43light
13:43program. And so this should be done in just a minute. All right. So it is all done. It says
13:48completing the Git setup wizard. We can launch Git Bash or view the release notes. I don't need to
13:53view the release notes, but I do want to launch Git Bash. Let's go ahead and click finish. And there
13:59we
13:59go. It's going to go ahead and open up Git for us. So this is Git Bash. And now we
14:05do have this
14:05installed. Now in the next lesson, what we're going to do is we're going to get in here. We're going
14:09to
14:09initialize a repo. We're going to have some files and see how we can save it and create those snapshots
14:15like we talked about in the last lesson. But right now we have it installed. This should be good to
14:20go. Now let's come up here to GitHub. And what we're going to do is we are going to sign
14:24up for
14:24a free account. What we have to do is provide an email, password, a username, and where you live,
14:30and we can create our free account. So let's go ahead and do that. Now that I have that filled
14:34out,
14:34I called my username Alex the Analyst Git Series because I already have a bunch of other GitHub
14:38accounts. And so I can't just call it Alex the Analyst. But let's go ahead and create our account.
14:43And now we need to go to our email and type in the code that they gave us. Let me
14:47go get that code.
14:48All right. I went ahead and put it in there. And now we have created our account. And now we
14:53just need
14:53to sign in. So if it's a Google account, you can sign in with Google. If it was just an
14:57email or username,
14:58you can do that and put in your password. I'm going to go ahead and sign in with my username
15:03and
15:03password. Let's go ahead and click sign in. And now we have a GitHub account. Congratulations.
15:10Let's come right over here and let's go to our profile. So in our profile, we can see how many
15:16commits we've made, which is basically none. I guess we have one. It's saying we have a commit,
15:20but I didn't make any commits. And then we have no repositories. So we are going to,
15:25in the next several lessons, we're going to learn a lot about Git.
15:27We're going to learn how to connect Git to GitHub and learn how to collaborate between the two,
15:32very much like you would in a real job. Hello, everybody. In this lesson,
15:36we're going to be taking a look at the basics of Git. Now I have several things open on my
15:42computer
15:42screen here. First, I have Git Bash open. Go ahead and pull that up on your screen. You should just
15:47be
15:47able to search for it and open up Git Bash. We looked at how to install Git in the last
15:52lesson.
15:53So you should have that installed. Just pull up Git Bash and it should look something like this.
15:57Of course, with your information right here. The next thing that I have pulled up and I'm on a
16:03Windows is I have my file path. So I have my file folder. I have file paths here. So right
16:08now we're
16:08just in my downloads, but we'll be using this as we go on. And the last thing that I have
16:13pulled up
16:13right in the background here is Visual Studio Code. Now this is going to be our IDE that we are
16:19using
16:19in the next several lessons, but you can use any IDE and you can connect it. This is just the
16:24one that I
16:24personally use a lot. And I think it really integrates well with Git and GitHub later on
16:30in this series. So if you haven't already, I will leave a link down in the description on where you
16:34can download Visual Studio Code. Again, you don't have to use it. You can use any IDE that you want,
16:39but this is the one that I recommend and I think that most people will be using. So here's what
16:43we're
16:43going to do. We are going to take a look at Git and we're going to see kind of where
16:48it defaulted to,
16:49because we just installed it and Git is on our computer, but we haven't done anything to it.
16:55We haven't set it up. We haven't kind of customized it to our project. And so we need to do
16:59all of
17:00these things. The first thing I'm going to do is I'm going to come right down here and I'm going
17:04to
17:04say PWD. And this is going to tell us the current file path that it's on. Now let's come down
17:10here
17:11and we're going to go to my C drive and we're going to go down to users and we're going
17:15to go to Alex F.
17:16This is the current drive. And there it is. There's .git. Let me pull this up a little more.
17:21Now, this is my C drive on my computer and it just has a bunch of old stuff. This is
17:27back when I was
17:27creating a lot of Python tutorials and web scraping tutorials. And as you can see, there's a lot of junk
17:34in here. And so if I come over here and I look at this, I'm just going to say LS.
17:39It's going to take
17:39a second because it's going to pull in all these files. It's going to pull in all these folders,
17:44which had a lot of stuff in it. And so as you can see, this is really messy. There's so
17:49much
17:50junk in here. Honestly, I should go through and delete a lot of this, but I hold onto it for
17:54sentimental reasons, potentially. And what I need to do is I need to either clear this out and make
18:00the C drive like really clean, or I just need to create a new folder. And when I'm doing a
18:06new
18:06project, I usually just create a new folder. So let's come in here and we're going to do a new
18:11folder here. I'm going to call this, let's call it AA just so that it shows up at the very
18:16top,
18:16because I have it in alphabetical order. We're going to say AA get video series.
18:22And so let's go ahead. Well, we can either refresh right up here and it should show up
18:28right near the top, at least right here. It didn't show up, I guess at the top,
18:33I have too many other ones, but we have our AA get video series right here. Let's open this up.
18:38And this is beautiful. There's nothing inside of it. This is just, it's lovely, right? But we don't
18:45have access to this just yet. We need to do something called a change directory. We need to
18:50go in here and say, this is where we want get to be pointed at. So we're going to do
18:56a change
18:57directory, a CD, and then we just need to put in here, this right here. So I'm going to do
19:03a control
19:03C on this. But when we come in here, it's different for pasting it, we have to do a shift
19:10insert,
19:10just like that. And actually, I need to put this in quotes, but I need to do shift insert,
19:16put that in quotes. And there we go. So now you can see right here, there is a new directory
19:23and it's
19:23pointing at this file path right here. So now we have it in here. But even if we refresh this,
19:29there isn't anything in there. What we have to do, especially if you're starting a new project,
19:34and we're about to start adding files, and we're about to start coding, and this project is going
19:39to last more than a couple days, maybe weeks or months, we want to capture all those snapshots of
19:44all the code that we're saving and everything like that. So we need to initialize a repository in here.
19:50So let's go ahead, we're going to say git init. That just means initialize a repository. Let's go
19:57ahead and hit enter. It said initialize an empty git repository at this location. So now we have this
20:03dot git here, which means that we now have an empty repository that we can start adding and committing
20:10files to. So it takes those snapshots of the history of this file path. And so if we add files
20:16to this,
20:17and I'm going to show you how to do that in just a second, we're going to add files, we're
20:20going to
20:20add and commit them. And then we'll see how we can look at our previous history. So let's do the
20:25same
20:25thing that we did up here. We did this LS. Let's go ahead and look at LS. And you'll see
20:32that there are
20:32no files in this file path. Well, let's change that. Let's come right over here. And let's go into our
20:39Visual Studio code. Now what we're going to do is we're going to come up here to explore. But in
20:44a second,
20:44we're going to come down here to source control. And this is where git is literally integrated into
20:51VS code, which is really, really nice. But first, let's open up our folder. And let's go to the
20:57project folder that we just created that's in users, Alex F, and then the AA git video series.
21:04So we're going to add this. And now we have it open. But of course, we don't have any files
21:10in it just
21:11yet. And then if we come right here, you can see that now it is connected. So now we have
21:17this
21:18master branch right down here connected to this AA git video series. That's because in our folder,
21:25we have a git repository initiated. So when we connected to that file path within our explorer,
21:32it picked up the fact that we are connected to git already. And it connects to this. Now,
21:36this is going to help us a lot. We're not going to use this right now. We're going to do
21:41everything
21:41within git. But there is a great UI in VS code that allows us to do a lot of what
21:47we're about to do in
21:48git. But I want to take a look at the basics first, and then we'll use VS code after. So
21:54what we're going
21:54to do is we're going to create a new file. So we're just going to come up here, you can
21:57either say
21:59control alt windows n or whatever the shortcut is on your computer. But let's go ahead and click on a
22:03new
22:04file. And let's just add a Python file. Let's keep it really simple. So I'm just going to add a
22:08comment here, I'll say this is a new file and our first commit. And we're going to go ahead and
22:16save
22:16this, you can do control s, you can save it right in here. And I'm going to rename this, I'm
22:21just going
22:21to say first file, first underscore file. And let's go ahead and save it. So now we have this file
22:28in
22:29our folder. And we can see that right here, we have this first file. Now, again, there are some
22:35things that we're going to look at specifically in VS code, but we're not looking at that right now.
22:40Let's come over here. And let's take a look in git. So now we're going to say ls. Now it's
22:48going to read
22:48in that first file, it shows that we have a file in it. But if we go and we write
22:53git status, right here,
22:56we're going to get some information, the status basically tells us where things are in the process,
23:01have they already been added to the git repository, and therefore we can go back and look at them,
23:06have they been added but not committed. So we're going to do that in just a second,
23:09we're going to commit this first file, we can see on branch master, which is our master branch,
23:15we have no commits yet, we haven't made any commits. So nothing is in our git repository over here.
23:21So we have an untracked file, our first file.py, but nothing added to commit, but untracked files
23:29present. So this is our untracked file. So here's what we need to do, we have to do two things,
23:33I pulled this up just so we can kind of see it. But right here, we have to do two
23:37things,
23:37we're in our working directory. So that's where we're currently at, we have our working directory,
23:42but we have to first add it to our staging area, then we commit it. And that's to our
23:48local repository, that's our git repository, which we can then use to take those snapshots.
23:53So let's first use git add, and then let's git commit. And let's see how that works.
23:59So we're going to say git add. Now when we get here, you can specify this file path. And you
24:07can
24:07just say first file.py, and it's only going to add that file. So if you have like 20 files
24:12in here,
24:12and you only want to upload the first file.py, you can specify that. I don't almost ever do that.
24:19I usually just hit period, which means take everything in this file folder. And we're going
24:25to add that if there have been changes made to that file. So we've made changes to this file.
24:30So we're going to hit git add everything. And now let's go and hit git status again. And now you
24:36can
24:36see we have a new file. These are changes to be committed. We haven't committed it just yet.
24:41But we are ready to commit this. Once we commit this, it will be stored in this git repo. And
24:49again,
24:49we can revert back to this. So let's come in here. And we're going to say git commit. Now,
24:56don't make the mistake that I made when I was first doing this and hit just hit enter. You can
25:00do this,
25:02but it brings up the separate UI. And so I don't recommend doing that. You can still write your
25:06message and everything in there. But we're going to do dash m, which means here's our message for
25:11this commit. So when you make a commit, you have to have a message. It doesn't have to be a
25:15long
25:15message. It can be very simple. But when you go back in time, and you go to those past snapshots,
25:21you can write yourself messages. And so we're going to say, this is my first commit.
25:27Woohoo. And that's our commit. That's our commit message. Let's go ahead and commit this.
25:33It says master root commit. This is my first commit. Woohoo. One file changed one insertion
25:39created mode. And then this right here is the file. So now let's look at git status again.
25:47And there we go. It says on branch master, nothing to commit working tree clean, which means we haven't
25:53made any changes to these files in here since the last time that we made a commit. So now that
25:59we've
25:59made a commit, now we can go and we can look at our log. So I'm going to say git
26:04log. And now it's
26:05going to show us our previous commits that we have made. And you can see this really long string of
26:11numbers and text. This is our hash, which we can use to revert back to that snapshot. So this is
26:18our
26:19kind of a snapshot hash code that you can use. And so this is actually very important. This is
26:24what you can use to tell git where to point to when you want to revert back to a previous
26:30commit.
26:31Now we're not doing that in this lesson, but we'll do it in a future lesson where we'll revert back
26:35once we made some changes. So now let's come right over here and let's go back. Because before,
26:41and it just got rid of it, but before it said U for untracked, which means it wasn't tracking anything.
26:47And now we can also go into our source control and we can see visually that there is a commit
26:51right here. And this is just awesome. When you start making a bunch of commits and a bunch of
26:55ads and you start branching and merging, this little UI down here is actually really helpful.
27:00At least it helps me a lot. Let's do something really quick. Let's come back here and we're
27:05going to make a change to this file. So I'm going to say, this is our code. And I'm just
27:11going to make
27:11some really ridiculously simple code and say, I love git. There we go. And then we're going to
27:19save this control S. So now we've saved this file and now we have a new letter right over here.
27:26It
27:26says that this file has been modified. And so it's giving us a visual indicator that, hey, this has been
27:32changed. It has not been saved. So if we go over to our source control, we now see that there
27:38were
27:38changes made to this first file.py. It was modified, but it hasn't been committed yet.
27:43So we haven't added this and we haven't committed and it's not saved in our git repo.
27:49Now, just to make this a little bit even more obvious, we're going to add another file. So again,
27:54just add a file. We'll do text file. It doesn't matter. I'm going to say, this is a text file
28:02for the git series. That's all I'm writing. And we're going to save that.
28:07And I'm just going to call this one first text file. And we're just going to save it as a
28:14txt file.
28:15So now that we've added it, now we have this green u. This means it's untracked. This file has not
28:20been
28:21saved in the git repo at all. And we need to do that. So again, let's go back to our
28:27source control.
28:29And now we have a u right here. So you'll notice we have some options under here within our source
28:34control for each file. We have open the file, discard these changes, which means we can completely
28:41get rid of this, which we can do, or we can stage the changes and then we can commit them.
28:48So let's only stage right now this first file.py. Now we have it in two separate sections. One is
28:55just
28:55their changes have been made. The other is this one has been added to the staging area, which again,
29:01if we come back down here and we look at this by adding it to the staging, we just added
29:07it right
29:08here. We just did the git add, but just with the click of a button, we can also unstage the
29:13changes
29:13or we can add them both. What we're going to do is we're going to make another commit. So now
29:18we're
29:18going to come up here and let's get rid of this. We're going to make another commit. So let's commit
29:22this and it wants a message here. And so I'm not going to do that because that's not typically what
29:28I
29:28do. I'm going to enter my message right up here. I'm just going to say second commit
29:34with updated file. Now, usually with this message, it should mean something. You should kind of
29:40indicate what you're doing with it or what you've done, but you know, that isn't super important at
29:45the moment. Let's go ahead and commit this. And you'll see right down here, we now have a second
29:50commit. So this is our first commit. And then right up here, this is our second commit. Now look at
29:55this
29:55thing right here. This is our hash. We can save this or we can copy this using this button.
30:01But if we go up, that hash has completely changed. And it's also noted that this was saved who it
30:07was,
30:07where it was saved and what that commit message was. It also will tell us that one file was changed,
30:14six insertions and one deletion. So it gives us some information. And again, that's something we'll
30:18look at in a future lesson about how to look at those differences. But if you'll notice up here,
30:23we didn't commit this one. And that's because we never added it to the staging. So let's stage this.
30:28Let's say this is our third commit with text file. And let's commit this. And now we have three
30:36commits. Our first commit, our second commit, which I misspelled with. That's a shame. And then we have
30:43our third commit. Now these are all on the master branch, right? But in a future lesson, we can create
30:50separate branches within our GitHub repository. And that's going to totally change the game and
30:55how we do our workflow and a few other things. Hello, everybody. In this lesson, I'm going to
30:58show you how you can revert back to a previous commit. Now, if you haven't been following along,
31:04this is about the third video in this Git series. And up until now, we have created a few separate
31:10commits over here, one with a small spelling issue. That's no problem in the commit message.
31:14Now, what we've done so far is we've created our working directory, we use git init. And then we
31:19added these to the staging area, we committed them to a local repository. But what we now want to do
31:25is come right down here and go back in time, we want to use git checkout. And we want to
31:30actually
31:31check out a previous commits and put that into this working directory. And so let's see how we can do
31:37this. So we have these previous commits. And this is our first commit. And this is when we first
31:43created this file. And if we come right up here, we only have this comment in our code. And we
31:52added
31:52this in our second commit. And so let's pull up this right here. And of course, our git bash. Now,
31:59what we can do is we can just use git checkout to go into something called a detached head state,
32:07where we're just looking at our previous commits or where we were in that snapshot,
32:12we're just looking at it. So let's say git checkout. And then what we're going to do is
32:17we're going to copy this entire hash. And so I'm going to do this. Now, in order to copy this
32:23in
32:23here, and I'm on a Windows machine, you control insert. And then if I bring it right down here,
32:28I need to do shift insert, I'm going to hit enter. And now we're going to get this message. And
32:33it's
32:33going to give us some good information. And let's just see what it says. It says you are in a
32:38detached
32:39head state, you can look around, make experimental changes and commit them. And you can discard any
32:45commits you make in this state without impacting any branches by switching back to a branch.
32:50If you want to create a new branch to retain commits you create, you may do so now or later
32:55using dash
32:56C with the switch command, and then they give a little example or undo with git switch. Now,
33:02this is just advice, you can turn this off. Now, what we're able to do is we can say ls,
33:07and this is our directory. Now, we are taking a snapshot of this one right here,
33:13we're going back and we're checking it out. And remember, we had two files in here previously,
33:18and now we only have one. So it is showing us in our file path, as well as in git,
33:23that there's only one file in there. And if we go into our Visual Studio code,
33:27this file doesn't even exist anymore, it's gone. And if we go to our first file,
33:32that code that was previously down here is not there anymore. So this one is deleted,
33:37because it's not in that current git path. And this one is reverted back to the code that we had
33:44only at the point or the snapshot of when we made that first commit. And so this is a very
33:49important
33:50concept to understand when you're using git, is we are looking at this snapshot. Now we looked around,
33:55and, you know, we don't need to go back and change anything for that specific one,
34:00we actually want to go back to this one, we can do that. But I'm gonna show you a little
34:04bit more
34:05than that. What we can do is we can say git checkout, and then we have our master branch,
34:11and I'm just gonna say master in here, let's go ahead and hit enter. And we've now come to our
34:16most
34:16recent commit in this branch. Now, this is our master branches, our main branch, I call it main and
34:22master because GitHub calls it something different, git kind of had the default of master.
34:27But ours was called master. And so we used right here, git checkout master to come back to our most
34:33previous one. And so now if we look at our LS, now we have both of those files, this code
34:38is back to how
34:38it was, this code is now there. And so everything in the world is right. But let's say we want
34:45to go
34:45back and we want to make some changes, I don't recommend just going back and checking it out and making
34:51the changes right there, I actually recommend creating a new branch. Now let's say, let's
34:56actually come down here, we'll do git log. Let's say we want to come back to this second commit right
35:05here. So we just updated this first file, we hadn't even added this text file in, but it had that
35:11code
35:11in there. Let's say we want to go back and we want to change some things, but we still want
35:16to keep some
35:17this other information with this latest file. So let's say we want to come back, and we actually
35:22want to start at this right here. So this is our second commit, we just updated this first file with
35:28this code, that's all we added, this was our code from our second commit. But we want to add a
35:34little
35:34bit more, but we want to also save what we're currently working on. We're gonna do something
35:39called creating a separate branch. And a branch looks something like this, we have our master,
35:45and that's what we're working on right now. But you can create this branch, where you can work
35:49parallel to your master branch, and then you can merge it back to your main work. At the same time,
35:57this is great for collaboration, because someone else can also create a separate branch, work on that
36:01work, and they can merge it back. Now in this lesson, I'm just going to show you how to create
36:05the branch, and you can do work there. But in the next lesson, I'll show you how to create a
36:11branch,
36:11do some work over here, and then how you can merge it back into the master branch, because that is
36:17how
36:17an actual workflow when you're using Git or GitHub, that's an actual workflow within it. So I want to
36:23show you how to do that in the next lesson. So let's come in here, we're going to do git
36:28checkout.
36:29But instead of specifying, here's where we want to go, I'm going to first say dash b. So I'm creating
36:36a
36:36branch from this location, but we need to name it really quickly. So I'm going to call this branch
36:44for work. So that is the name of our branch. And now we need to specify, and whoops, see,
36:50I accidentally tried to use Ctrl C. Let's try this again. We'll do, sorry, git checkout dash b,
36:58we'll call branch for work, I need to come up here and use Ctrl insert. And then I need to
37:05say
37:06shift insert. So now we're saying git checkout. So I'm checking this out, I'm creating the branch
37:13and naming it. And this is the one we're checking out. Let's go ahead and hit enter. And now you
37:19see
37:19something a little bit different. We've switched to a new branch that we just created. And then right
37:25over here, instead of master, it says branch for work. So this is our current branch that we are
37:30on. So now we can add files, we can come in here and change things. And if we want to,
37:38then we can merge it back to our main branch with all this new work that we've done. So in
37:42the next
37:43lesson, we're gonna see how we can add files to this branch, and then merge them back into the main
37:48branch. Hello, everybody. In this lesson, we're going to be taking a look at branching and merging.
37:52Now in the last lesson, I already created a new branch, I'm going to kind of walk through because
37:57this may be the first one you're watching, I'm gonna walk through how to create that new branch.
38:00And we'll walk through a little bit about how it works and how to merge it back into this master
38:05branch. So what we've done is we were here on this master branch, and we just said git checkout. And
38:12we
38:12checked out a previous version, a previous commit using this hash right here, and we named it branch for
38:18work. So now we're on this separate branch, we just we're on our master, and we made this branch
38:24upward. And now we are right here. So just for demonstration purposes, let's go back to our git
38:30checkout master. So we're actually going back to the master branch, we have created this branch for
38:37work. And so if we want to get to that, we can go and go back to this branch, or
38:42we can create a whole
38:42new branch, either one is perfectly fine. I'm going to show you how to create another branch,
38:46and then we go back to this branch for work in just a second. So let's create this other branch,
38:52just a brand new branch. So to create a new branch from our master branch, it's going to be really
38:58easy, we're going to say git checkout dash b, and then we name it, we'll just call it new branch.
39:05And
39:06then we're taking that from master. So our current work, let's go ahead and hit enter. And now we're on
39:12this new branch. Now this is with our current files. But what we were doing with our branch for
39:18work is we opened up a previous commit, instead of our master. So instead of master, we opened up
39:25using this hash right here. So let's actually switch over back to that previous branch that we created
39:31called branch for work. So to switch back, it's really easy. We again say, git checkout, and then
39:38we'll say branch for work. Let's go ahead and hit enter. And now we're on our branch. Now this previous
39:46branch does not have all of our commits. So this file was not in that previous commit that we're
39:51looking at that second commit. And that's what we're going to do, we're going to add some files.
39:55And then we're going to see how we can merge this back into our master branch. So let's go right
40:01over
40:01here. Let's go on up. We only have this first file. So we're going to make some changes. We're going
40:07to
40:07say, this is a change to our code. And I'm going to print out, I love merging and branching. Nobody
40:18actually says that, but we're going to say it. And I'm going to save that. And then we'll also add
40:22a file.
40:23If you watched our previous lesson on Visual Studio Code, this means it was modified. So we're
40:28going to add a new file now. And we're going to call this one branched file.txt. So it's just
40:36a
40:36text file. So I'm just going to say, this is a text file for the new branch. And that's all
40:44we're
40:44going to do. We're going to save this. So I did control S. And so now we've made a modification
40:49to
40:49a previous file. And we've added a new branched file.txt, completely separate. So here's what
40:56we're going to do. We're going to go back. And this is our current file path. So we have that
41:02branched file. And then we also have a modification to the first file. Here's what we need to do to
41:10merge this back into our master branch. Because now we've added this new file, we've made some
41:16changes to code. This looks great, but we need to get it back to our master branch so that other
41:21people can see it. We can put it into GitHub. We can share that with our team. So here's what
41:26we're
41:26going to do. We're going to go back to our master branch. We're going to say git checkout master.
41:31So now we're in our master branch. And if we say LS, you'll notice that that file is there. But
41:38if we do git status, you'll see that we have a modified and we have this file right here. So
41:45we
41:45haven't committed or made these changes yet. All we need to do is we can say git merge branch for
41:54work. So it looks like when we switch back to this master branch, it already made the merge. In fact,
41:59let's check this. We'll say git log. As you can see right here, we have our first commit. We have
42:04our
42:04second commit. And then for a third commit, we have head to master. But then we also have this
42:09new branch. And so it merged it back to the main branch when we went and checked it out.
42:15But it still hasn't committed and saved this to the GitHub repo. So we still need to git add.
42:21Actually, let's do git status first. So we still need to say git add dot. And then it's going to
42:28add
42:28everything. And then we need to say git status again just to check it. And now the modified and the
42:34new
42:34file are there. And now we need to commit this. So we're going to say git commit dash m. And
42:41here's
42:41our message. We're going to say committing files after merge. And so now these files were added
42:49and they were updated and modified in the main branch. So all that work that we were doing in
42:54this other branch is now in our master branch. And if we come back here, it should have that updated.
43:00And it will note that we have added these files and made those changes. So that's how we create
43:06these other branches. And then we bring them back and put them in our main branch. Now, it's really
43:13important once we do have this master branch, or even if we have these other branches, is that we put
43:19this to where other people can see it. That's in our GitHub. So in the next lesson, we're going to
43:24connect
43:24our git with our GitHub. So that's our local repository with our remote repository, so we can sync these
43:30up and use them in parallel. Hello, everybody. In this lesson, I'm going to show you how to connect
43:35your local git repository to your online git remote repository. So we've been working for the past
43:42several lessons, we've created a repository. And now we want to connect this to GitHub so that we can
43:49remotely store and have all of our commits on GitHub, not just on our local machine. So in here, we
43:56created our GitHub. But now what we need to do is we need to come in here and create a
44:01repository.
44:02So we're going to select a new repository, I'm going to call this the git series repo. And I'll create
44:09this as a public repository. So anybody can go and take a look at this. And we're not going to
44:14change
44:15anything else. Just keep it super duper simple. Let's go ahead and create this repository.
44:20And it's going to be completely blank. Nothing is in here. There's no files, there's nothing.
44:25And what's great is that GitHub knows they are very good. They know that you want to connect this
44:31to your git repository. And so they give us instructions on how to do that. So if you want
44:37to create a new repository on the command line, you can or push an existing one. Now that's what we
44:42want
44:42to do. So we can copy. Well, I'm going to copy this. We're going to add a remote origin. And
44:50origin
44:50is just the name. But let's look at this in a second. Let's come over here. I'm going to do
44:54shift
44:54insert. So git remote add. We're adding a remote repository. And we're calling it origin. That's kind
45:01of like a default name. We don't have to call it that. But it's just common for people to do
45:07that.
45:08And then here is the link to this remote repository. And that's it. Let's go ahead
45:15and hit enter. And so now we have connected this local git repository to this remote repository in
45:23GitHub. So now what we're going to do is come over here and we're going to click on publish branch.
45:30This is going to allow us to sign in with GitHub. So we're going to sign in with your browser.
45:37Then we're going to authorize the git ecosystem. So we're going to say authorize. Now we're going
45:42to come back here. And we're going to bring up our VS code again. And it looks like we've already
45:47put
45:47it into the GitHub repo. And you can see it right here. You can see that you can open it
45:51on GitHub.
45:52But it also has this little emblem that says that origin main is now in GitHub. So let's go back
45:57to our
45:57GitHub. Let's click refresh. And now we can see all of our files in here. So now we've connected
46:07our local git repository to our GitHub remote repository. And now they are synced up. Hello
46:14everybody. In this lesson, we're going to be taking a look at GitHub. And then what we're going
46:18to be doing is seeing a little bit of a workflow of using both git and GitHub together. If you
46:23remember
46:24from our last lesson, we connected git to GitHub. So now we can work on a little bit of that
46:29workflow
46:29of how it would actually look using both of these tools at the same time. We also pushed all of
46:35our
46:35stuff from our local repo in git into this GitHub repo right here. The first thing that we're going to
46:40look at is we can actually take a look at our previous commits. So these are all the commits that
46:45we
46:45made on our local repo. But when we connected it and we pushed it up into GitHub, we still have
46:52all of
46:52those commits here that we can see. And so that's really great to see. We can also go in and
46:58this
46:58is our first file.py. We can click on this file and we can actually look at the code that
47:04is in
47:04here as well as, of course, our other files as well. The next thing we're going to take a look
47:10at
47:10is a pull request. Now we're going to be looking at a pull request in just a little bit. We're
47:15going
47:15to see how that works. But a pull request is something that is different between GitHub and git.
47:21On git, you can just commit and merge and do all those things basically whenever you want. But
47:27within GitHub, we do have to create a pull request, which is how you approve code and you get things
47:34merged back into the main branch. We will be taking a look at that in just a little bit.
47:39There also is issues and issues are really common, especially within larger teams. So if you're working
47:46on code, you can create a new issue and you can assign it to somebody. You can label it. You
47:51can
47:51assign it to a project or whatever milestone you might be working on and you can create it.
47:55And so, you know, if you're going back in the code and you see, oh, there's something wrong with this
48:00first file in our output on our website or for this customer, they're getting something weird.
48:05So we create an issue, we assign it to someone, and then it will show up right in here. So
48:10let's go
48:10ahead and create a new issue really quick. I'm just going to assign it to myself. And I'm going to
48:14say
48:15first file not working correctly. This is a terrible title, but then in here, this is the details you
48:25need to know. So then I would write up, you know, here's what's going on. Maybe I need to attach
48:30a file
48:31or something, but here you need to know. And I'm going to create this. And so now, if I come
48:39back
48:39to issues, we can see that this is assigned and I can make sure I can see the ones that
48:45are assigned
48:45to me. And I'll come in here and then I'll say, I fixed this. And I can just say, close
48:53with comment.
48:54So now it's going to be closed out. I fixed this issue and now it is closed. And so that's
48:58how you
48:58assign and you can get things assigned to you from your team. If I hop over here to projects,
49:05projects is a little bit, there's a lot of things that you can do in projects. Let's get rid of
49:11this.
49:12But a lot of teams will use this almost like a JIRA board or a Kanban or Kanban board, however
49:17you say
49:18it. But you can create these different projects and you can assign different things to people.
49:23Let's just create a board here. And it's just a blank one. But this is like a board that you
49:29use
49:29it with any other project as to do and progress done. And this is where a project manager or somebody
49:34on your team might come in and organize this. They might have things set up that you need to
49:39accomplish that your team needs to accomplish. So this can be really useful. If I'm being honest,
49:43though, my team almost never use this. We always use something like JIRA or something that
49:48Microsoft tags, your Microsoft shop. And so I didn't use it that much, if I'm being honest,
49:53but you can use it. Let's go back into our Git series. The last thing I want to show you
49:59is we
50:00can create other branches in here. So right now we only have the main branch. That's all we pushed.
50:05But we can create multiple different branches in here. And when we create these separate branches,
50:10we can then make changes on these branches and merge it back into our main branch. So let's go up
50:15here. Let's click on this branch. And we have our main branch. And let's go ahead and let's just
50:21create a new branch. Let's get wild. We're going to say new GitHub branch. And we're going to create
50:30this new branch. So now if we go back, we're going to go to our code. If we go back
50:36to main,
50:37we now have our main. That's our default branch. We have this new GitHub branch. Let's go ahead and
50:41click on this. This is basically a copy of our main branch. And so it has all the same commits.
50:47It has all the same files and information in here. But let's go ahead. Let's add a file. We're just
50:54going to create a new file. And we're going to come in here. We're going to name this file.
50:58So I'm going to call this a GitHub file.py. We're going to say this is a file just for
51:06GitHub.
51:07GitHub. And we're going to commit these changes. And go ahead and commit them. And now we're getting
51:13this message that says this branch is one commit ahead of main. Because we just went into this new
51:18branch. And we added a new file. And we committed it. Now if we go back to the main branch,
51:23you're
51:24going to notice we no longer have that new file that we created. It's just in that separate branch.
51:29But now we're going to get this message up here. It says new GitHub branch had recent pushes 15 seconds
51:35ago. It's going to want us to compare and create a pull request. Let's go ahead and click
51:40on this. So if we do this, we're going over basically to opening a pull request. What this
51:47does is it creates a new pull request by comparing changes across two branches. And if you need
51:51to, you can compare them across forks as well. So we can create this pull request. So let's
51:56go ahead and create pull request. And it's going to see if there is a conflict with the branch.
52:03Now, conflicts within a branch means that a file was changed in both the main branch and
52:10it was changed in a different branch. And if you tried to merge them, you're going to get
52:14a conflict because you changed both of them. Of course, we didn't do that. So now we can
52:18merge this pull request. Let's go ahead and merge this back into the main branch. I'm going
52:23to confirm this merge. And now you can see that this was appropriately merged. Let's go back
52:28to our code. And now in our main branch, you're going to see that that GitHub file was added.
52:36And so now both of these branches are up to date. The only thing that is not up to date
52:41is if we come back here. Because if we come back to our local repository, this is not updated.
52:48And so let's see how we can pull that new file that we created in GitHub. And we're going to
52:54pull that down to our local repository. And just by clicking refresh, it says that we've
52:59synchronized those changes. But let's come back to our source control. You can see right
53:04over here, we committed these files. But then you see this little orange line right here.
53:09It says that we created a GitHub file. Then we merged that pull request within GitHub. And
53:16now main and origin main, which is GitHub, are both on the most recent commit.
53:21Now, what you may also want to do is you may also want to come in here and say get
53:26whole
53:28origin main. And that is also how you can pull that down just using get natively. Of course,
53:33we are already up to date. So we don't need to do that. But let's go add one more file.
53:38And
53:39let's just test that out. So we're going to come in here, we're going to add another file,
53:42we're going to call this GitHub file two, and just say, this is the second file.
53:51And we're going to go ahead and commit these changes. And this should be on our main branch.
53:56So we should be perfectly fine. So there we go. Now we're going to write the same thing. So this
54:02is
54:02on our local repo, we're gonna say get pull origin main. And then it's going to say, okay, let's bring
54:09down everything that we don't already have any changes, any new files, if it's new, and it doesn't
54:15sync up to our last commit. Let's take a look at that. So we have this one file changed. That's
54:20our GitHub file two. Let's go ahead and say LS to take a look. And now you can see that
54:25we have
54:26that GitHub file two right here. We didn't call it dot py, we probably should have. In fact, we could
54:32come in here and change that if we want to, but we don't need to. But let's go back now.
54:36We have
54:37Git. Let's open up VS Code and Git. If that file is showing right here, we should also see it
54:44right here. So we open that GitHub file two, and this is the second file. And so that's how we
54:49can
54:50pull down files or changes from GitHub. And typically that happens when someone on your team uploads a
54:56new file, or a client uploads a new file, and you want that file locally, so you can actually do
55:00your
55:01work. And so you'll pull that down. So then it's in your local file folder, and you can actually use
55:06that file. And the same thing would apply. Let's say in here, we need a new file. We're going to
55:10create a new file. Let's say it's a Python file. We're going to say this is the latest file with
55:18our code. And we're going to go ahead and save this. And let's call this Git file one. And let's
55:26save
55:26that. So now we have a file that is untracked. It hasn't been put into any repository, local or
55:33remote. But we can come over here. And we can first add this. So we're adding it to our staging
55:39area. And now we can commit this. I didn't add a message. Let me actually get rid of this. Let's
55:44add a message. We're going to say Git local repo. Whoops. Let's do Git local repo change. And we're
55:53going to create that commit. But now these are out of sync, right? So now we have our GitHub repo
55:59that's back here. So we have a file behind. And then we have our local repo. And we just did
56:05a
56:05bunch of work. We worked really hard on this Git file one. And we want to push that so that
56:10it's in
56:10the GitHub. It's shareable. We can access it. And so can the people on our team. So we're just going
56:15to
56:15click sync changes. And it's going to sync up to where that file is now in GitHub. And they're both
56:21on the same place. So now let's go back. And if we click refresh right here, we should see that
56:28Git
56:28file one as well. And that's a really common workflow. Of course, like we said in the last
56:33lesson, you may want to create a branch off of that and do your work and then merge it back
56:38into
56:38the main branch. So you weren't messing with the current files and you don't mess anything up.
56:43Of course, you can always revert back or check out a previous commit. And that is really the power of
56:48Git in a nutshell. And then you can share it to your GitHub so that people on your team or
56:53you
56:53can have access to it anywhere or have access to it later. So I hope that that was helpful. I
56:58hope
56:58that you learned something in this series. If you want to dive even further into Git and GitHub,
57:03I have a full course on my platform, analystbuilder.com. I will leave a link in the description if you
57:08want
57:08to check it out. If you have not already, be sure to like and subscribe and I will see you
57:11in the next video.
57:18Bye.
Comments