Skip to playerSkip to main content
  • 2 days ago
Take my Full Git and GitHub course: https://www.analystbuilder.com/courses/git-and-github-for-data-professionals

____________________________________________

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 Livestreams and you get some awesome Emoji's to use in chat
Transcript
00:00Hello, everybody. In this lesson, we're going to be taking a look at GitHub.
00:03And then what we're going to be doing is seeing a little bit of a workflow of using both Git
00:07and GitHub together.
00:09If you remember from our last lesson, we connected Git to GitHub.
00:13So now we can work on a little bit of that workflow of how it would actually look using both
00:17of these tools at the same time.
00:19We also pushed all of our stuff from our local repo in Git into this GitHub repo right here.
00:25The first thing that we're going to look at is we can actually take a look at our previous commits.
00:30So these are all the commits that we made on our local repo.
00:33But when we connected it and we pushed it up into GitHub, we still have all of those commits here
00:39that we can see.
00:40And so that's really great to see.
00:42We can also go in and this is our first file.py.
00:46We can click on this file and we can actually look at the code that is in here as well
00:51as, of course, our other files as well.
00:54The next thing we're going to take a look at is a pull request.
00:58Now, we're going to be looking at a pull request in just a little bit.
01:01We're going to see how that works.
01:02But a pull request is something that is different between GitHub and Git.
01:07On Git, you can just commit and merge and do all those things basically whenever you want.
01:13But within GitHub, we do have to create a pull request, which is how you approve code and you get
01:20things merged back into the main branch.
01:22We will be taking a look at that in just a little bit.
01:25There also is issues and issues are really common, especially within larger teams.
01:31So if you're working on code, you can create a new issue and you can assign it to somebody.
01:36You can label it.
01:37You can assign it to a project or whatever milestone you might be working on and you can create it.
01:41And so, you know, if you're going back in the code and you see, oh, there's something wrong with this
01:46first file in our output on our website or for this customer, they're getting something weird.
01:51So we create an issue, we assign it to someone, and then it will show up right in here.
01:56So let's go ahead and create a new issue really quick.
01:58I'm just going to assign it to myself and I'm going to say first file not working correctly.
02:05This is a terrible title, but then in here, this is the details you need to know.
02:12So then I would write up, you know, here's what's going on.
02:15Maybe I need to attach a file or something, but here you need to know.
02:21And I'm going to create this.
02:23And so now if I come back to issues, we can see that this is assigned and I can make
02:30sure I can see the ones that are assigned to me.
02:32And I'll come in here and then I'll say I fixed this and I can just say close with a
02:39comment.
02:40So now it's going to be closed out.
02:41I fixed this issue and now it is closed.
02:44And so that's how you assign and you can get things assigned to you from your team.
02:47If I hop over here to projects, projects is a little bit there.
02:54There's a lot of things you can do in projects.
02:57Let's get rid of this.
02:58But a lot of teams will use this almost like a JIRA board or a Kanban or Kanban board, however
03:04you say it.
03:04But you can create these different projects and you can assign different things to people.
03:09Let's just create a board here.
03:12And it's just a blank one.
03:13But this is like a board that you use it with any other project has to do and progress done.
03:18And this is where a project manager or somebody on your team might come in and organize this.
03:23They might have things set up that you need to accomplish, that your team needs to accomplish.
03:27So this can be really useful.
03:28If I'm being honest, though, my team almost never use this.
03:31We always use something like JIRA or something that Microsoft tags or Microsoft shop.
03:36And so I didn't use it that much, if I'm being honest, but you can use it.
03:41But let's go back into our Git series.
03:44The last thing I want to show you is we can create other branches in here.
03:49So right now we only have the main branch.
03:50That's all we pushed.
03:51But we can create multiple different branches in here.
03:54And when we create these separate branches, we can then make changes on these branches and merge it back into
03:59our main branch.
04:01So let's go up here.
04:02Let's click on this branch.
04:04And we have our main branch.
04:05And let's go ahead and let's just create a new branch.
04:08Let's get wild.
04:10We're going to say new GitHub branch.
04:15And we're going to create this new branch.
04:18So now if we go back, we're going to go to our code.
04:21If we go back to main, we now have our main.
04:24That's our default branch.
04:25We have this new GitHub branch.
04:27Let's go ahead and click on this.
04:28This is basically a copy of our main branch.
04:31And so it has all the same commits.
04:33It has all the same files and information in here.
04:37But let's go ahead and let's add a file.
04:40We're just going to create a new file.
04:41And we're going to come in here.
04:43We're going to name this file.
04:45So I'm going to call this a GitHub file.py.
04:49And we're going to say this is a file just for GitHub.
04:54And we're going to commit these changes and go ahead and commit them.
04:58And now we're getting this message that says this branch is one commit ahead of main.
05:03Because we just went into this new branch and we added a new file and we committed it.
05:08Now if we go back to the main branch, you're going to notice we no longer have that new
05:13file that we created.
05:14It's just in that separate branch.
05:15But now we're going to get this message up here.
05:17It says new GitHub branch had recent pushes 15 seconds ago.
05:22It's going to want us to compare and create a pull request.
05:25Let's go ahead and click on this.
05:27So if we do this, we're going over basically to opening a pull request.
05:32What this does is it creates a new pull request by comparing changes across two branches.
05:37And if you need to, you can compare them across forks as well.
05:40So we can create this pull request.
05:42So let's go ahead and create pull request.
05:46And it's going to see if there is a conflict with the branch.
05:50Now conflicts within a branch means that a file was changed in both the main branch and
05:56it was changed in a different branch.
05:58And if you try to merge them, you're going to get a conflict because you changed both
06:02of them.
06:02Of course, we didn't do that.
06:03So now we can merge this pull request.
06:06Let's go ahead and merge this back into the main branch.
06:08I'm going to confirm this merge.
06:10And now you can see that this was appropriately merged.
06:14Let's go back to our code.
06:16And now in our main branch, you're going to see that that GitHub file was added.
06:22And so now both of these branches are up to date.
06:25The only thing that is not up to date is if we come back here, because if we come back
06:31to our local repository, this is not updated.
06:34And so let's see how we can pull that new file that we created in GitHub.
06:39And we're going to pull that down to our local repository.
06:42And just by clicking refresh, it says that we've synchronized those changes.
06:46But let's come back to our source control.
06:49You can see right over here, we committed these files.
06:52But then you see this little orange line right here.
06:55It says that we created a GitHub file.
06:58Then we merged that pull request within GitHub.
07:02And now main and origin main, which is GitHub, are both on the most recent commit.
07:07Now, what you may also want to do is you may also want to come in here and say git
07:13whole origin main.
07:15And that is also how you can pull that down just using git natively.
07:19Of course, we are already up to date.
07:21So we don't need to do that.
07:22But let's go add one more file.
07:25And let's just test that out.
07:26So we're going to come in here, we're going to add another file, and we're going to call
07:29this GitHub file two, and just say this is the second file.
07:38And we're going to go ahead and commit these changes.
07:40And this should be on our main branch, so we should be perfectly fine.
07:45So there we go.
07:46Now, we're going to write the same thing.
07:48So this is on our local repo.
07:50We're going to say git pull origin main.
07:52And then it's going to say, okay, let's bring down everything that we don't already have.
07:58Any changes, any new files.
07:59If it's new, and it doesn't sync up to our last commit, let's take a look at that.
08:04So we have this one file changed.
08:06That's our GitHub file two.
08:08Let's go ahead and say ls to take a look.
08:11And now you can see that we have that GitHub file two right here.
08:14We didn't call it .py.
08:15We probably should have.
08:17In fact, we could come in here and change that if we want to, but we don't need to.
08:21But let's go back now.
08:22We have git.
08:23Let's open up VS Code and git.
08:26If that file is showing right here, we should also see it right here.
08:31So we open that GitHub file two, and this is the second file.
08:35And so that's how we can pull down files or changes from GitHub.
08:39And typically that happens when someone on your team uploads a new file,
08:43or a client uploads a new file, and you want that file locally,
08:46so you can actually do your work.
08:47And so you'll pull that down.
08:49So then it's in your local file folder, and you can actually use that file.
08:52And the same thing would apply.
08:54Let's say in here, we need a new file.
08:56We're going to create a new file.
08:58Let's say it's a Python file.
09:00We're just going to say this is the latest file with our code.
09:05And we're going to go ahead and save this.
09:07And let's call this git file one.
09:11And let's save that.
09:12So now we have a file that is untracked.
09:16It hasn't been put into any repository, local or remote.
09:20We can come over here, and we can first add this.
09:23So we're adding it to our staging area.
09:25And now we can commit this.
09:27I didn't add a message.
09:29Let me actually get rid of this.
09:30Let's add a message.
09:31We're going to say git local repo.
09:34Whoops.
09:35Let's do git local repo change.
09:38And we're going to create that commit.
09:40But now these are out of sync, right?
09:43So now we have our GitHub repo that's back here.
09:46So we have a file behind.
09:49And then we have our local repo.
09:51And we just did a bunch of work.
09:52We worked really hard on this git file one.
09:54And we want to push that so that it's in the GitHub.
09:57It's shareable.
09:58We can access it, and so can the people on our team.
10:00So we're just going to click sync changes.
10:02And it's going to sync up to where that file is now in GitHub.
10:06And they are both on the same place.
10:09So now let's go back.
10:10And if we click refresh right here, we should see that git file one as well.
10:16And that's a really common workflow.
10:18Of course, like we said in the last lesson, you may want to create a branch off of that
10:22and do your work and then merge it back into the main branch.
10:25So you weren't messing with the current files, and you don't mess anything up.
10:29Of course, you can always revert back or check out a previous commit.
10:33And that is really the power of git in a nutshell.
10:35And then you can share it to your GitHub so that people on your team or you can have access
10:40to it anywhere or have access to it later.
10:43So I hope that that was helpful.
10:44I hope that you learned something in this series.
10:46If you want to dive even further into git and GitHub, I have a full course on my platform,
10:51analystbuilder.com.
10:52I will leave a link in the description if you want to check it out.
10:54If you have not already, be sure to like and subscribe, and I will see you in the next video.
Comments

Recommended