Intro to Git, Github, and Version Control

You can access the full course here: Git and Github – Version Control and Collaboration

Part 1

What is Version Control and Git?

Version control is keeping track of software as projects are updated and new versions are released. A well-built system like git allows us to work on current versions of software while maintaining previous versions and even reverting back to older releases if necessary. Git provides a system that allows us to do this using just a few commands, executed through the terminal or command line interface.

What is Github?

Github is a hosting service that allows us to store projects in an open-source manner. We can create new projects, update, and retrieve project files and is excellent for collaborative projects. Github allows us to give access to team members and approve/disapprove changes as well as creating issues, merging software versions, and viewing previous versions in a well-built graphical interface. Github was built with git commands in mind so the two interact very well.

Why Learn this Topic?

Version control is a crucial aspect of keeping track of software changes, especially in a group setting. There are four main benefits to this: we can track previous versions, we can modify project files without affecting the current release version, we can store projects in a secure online database, and we can effectively collaborate with team members.

Tracking previous software versions helps us spot potential errors based on previous performance, figure out what has worked in the past and what needs to change in the future, and even revert back to previous versions. Using branches, we can work on new features and change parts of a project, only merging the new files with the older ones when they are ready to be released. Storing projects online is hugely beneficial as it protects against data recovery problems that may occur on local systems. Finally, version control allows us to retrieve project files, make changes to files or add n ones, and approve or reject changes as a team, as everyone we choose can access the project.

Part 2

Installing Git

We first need to get access to the git ecosystem and set it up

Git website with Download link circled

  • Select operating system (can install GUI client but we won’t be using that in this lesson)

Git downloads page

  • Download manually if it doesn’t auto download
  • Open the git-2.21.0-intel-universal-mavericks.dmg file and then the git-2.21.0-intel-universal-mavericks.pkg

Git download package after downloading it

  • If you are using Windows or Linux, the file extensions will likely be different
  • Go through the installation wizard step by step
  • To check to see if it’s installed, open a new terminal and type the command git –version  (note the double dash). This should return the currently installed version of git if it is installed correctly on your system

If you are using Windows, you can run all the commands seen in this course in Git Bash which already comes with git (that you just installed), instead of using the Windows Command Prompt.

Terminal with git version command run

 

Transcript 1

What is up, everyone, and welcome to our course on Git and GitHub. My name is Nimish, and I’ll be guiding you through the next hour or so, in which we’re going to be learning about how to add version control to our projects using Git and explore the GitHub ecosystem.

So what is this course gonna be about? This is just a quick course overview. We’re gonna learn how to use various aspects of version control. We’re going to use Git commands to help us add version control and use different parts of it. We’re going to get to know GitHub and explore some of its features. And then, we’re going to use GitHub with these Git commands to, effectively, use version control in conjunction with GitHub. Finally, we’ll be applying these concepts to an existing project. Although, you can apply this to any project that you’ve done previously.

Who is this course gonna be for? Who should be taking this? So, we’re expecting that you’ve probably never used Git commands before. If you have used Git commands, you might find this a little basic, although, likely, there’ll be a thing or two you can still learn. We’re assuming, again, you have no familiarity with GitHub. Perhaps, you’ve stored projects on there before at the very most. If you’re super-familiar with it, once again, you might find this a little bit slow.

We’re expecting that, at some point in time, you will want to store projects in GitHub or other hosting platforms. Again, one of the main focuses of this course is gonna be learning how to use GitHub. So if you have no interest in using GitHub at all, perhaps this is not quite the course for you. We’re also assuming that, at some point in time in your software careers, you will work or have worked on projects with a team. Likely, they will require you to use version control at some point, so this course will be an excellent intro to that.

Now, what topic at we going to be covering? This is just going to be a really quick breakdown of the different lessons. We’ll start with an introduction to version control. Then, we’ll talk about how to download Git onto our computers. Next, we’ll add version control to an existing project. This will just be kind of initializing version control on that project folder. Then, we’ll be exploring various Git commands to change aspects of our project ecosystem. Likely, this will take up a few different sections. After this, we’ll be creating a GitHub account and learning how to use Git commands with GitHub.

Again, this will take several different video sections as I’m, again, trying to keep the tutorials fairly short. And, after this, we’ll finish up by exploring various aspects of the GitHub ecosystem. This will be just kind of getting to know GitHub a little better and checking out some of the cool features that it provides.

Okay, so that’s a really quick course intro. Now, we know what we’re going to be covering. Let’s move to the very first topic which will be an intro to version control. Thanks very much for signing up for this. I hope you enjoy it and can learn a lot, and we’ll see you guys in the next tutorial.

Transcript 2

What’s up everyone, and welcome to the first part of our Git and Github tutorial series. This will be an intro to Version Control. Here we’re gonna be exploring what Version Control is, and why you should learn this topic.

So, what is Version Control? As a quick overview, Version Control is simply a way to keep track of software, as projects are updated and new versions become available. Essentially, it provides a way to view different versions of software files.

In almost all cases, when a piece of software, an app, program, etc, is released, it will be updated at various points in time. Perhaps, an entirely new version will come out. You’ll have likely have seen this in your phone’s operating system. It’ll be hugely beneficial for us to be able to keep track of what has changed throughout all of these versions, as maybe we’ll need to revert back to the previous version, or just kind of see how things have changed over time. This also allows us to work on project updates, without making changes to a release version until updates are ready to be pushed. This is again massively effective, because if we want to add new features, or just an entirely new version to our software, we don’t want to mess up the existing version that is out there.

In conjunction with Github, Version Control also provides a way to effectively share projects with team members, and also view the changes that they have made. There are also ways to approve or disapprove of changes as well, and it’s just a nice way to collaboratively work on projects.

So, what is Git specifically, then? Git is simply a version control system that allows us to apply version control functionality to our projects. Git is widely used through a command line or terminal interface. Now there are actual GUIs, or graphical user interfaces, that help you to execute Git commands a little more easily. Especially when paired with Github, we can definitely turn to the more graphical side of things, if you’re not comfortable using Terminal. But it’s a good idea to learn the command line commands as well, because you’ll be using that in a wide variety of ecosystems.

Now with Git, we can run various commands to achieve results, such as saving changes to files, pushing or pulling from online repositories, viewing file changes, and even merging different file versions. So, really Git just is a way to integrate different aspects of version control into our own projects.

So, what about Github then? Likely you’ve heard of Github if you’ve been around the programming community for any amount of time. Well, Github is actually just an online hosting system that is used to store various projects. Essentially, it can be thought of as a giant online database for software projects, and there doesn’t necessarily just have to be software.  Although, you’ll most commonly find software on Github.

The nice thing about Github is it provides a really good-looking GUI that’s easy to use, and we can use this to easily keep track of project versions, changes, issues (such as any bug reports), or anything that needs to be changed within a project. This makes it an excellent platform for sharing projects with team members, and it really interacts very nicely with Git commands as well. I mean the word Git is right in the name Github. So in essence, Github is just a big online database where we can store our projects, and we can use Git commands to interact with the version control aspect of Github.

So, why bother learning all of this then? We know what these things are, but how are they useful to us in general? Well, version control with Git and Github provides many benefits. For starters, we can keep track of software changes. As I said, this is beneficial, because we may need to check to see what we implemented in the previous versions for inspiration. Maybe we want to see what we want to change over time, and it’s just very beneficial to be able to revert back to previous versions if needed.

We can also work on branches of a project before releasing them. Again, if there is a stable version of your software out there that users are using, you definitely do not want to mess that version up while you’re working on new versions or new features. We can store files in an online database like with Github. Another popular one is Bitbucket, but we won’t be covering that in this course. But this is great, because obviously, you don’t want to store your software in just one location, in case of some kind of a data failure.

And finally, we can collaborate with team members through the use of Github, and other online repository systems. This is really helpful, because then we don’t have to share files through things like Google Drive, Dropbox, USBs, or something inefficient like that. We can just kind of store projects in one location, and give the people we want access to it.

Now, also most companies that have anything to do with software use some kind of version control. In fact, I can’t, off the top of my head, think of a company that doesn’t use Github or something very, very similar, just because it’s such a powerful tool for storing and collaborating on projects. So, if you want to apply to software companies in the future, there’s a very, very good chance they’re gonna want you to learn how to use Git and Github. If you already know that, all the better. So that makes it an essential skill for software developers of any field. Really doesn’t matter if you’re in mobile work, mobile applications, or web applications. Maybe you’ll work on desktop software or something, and there’ll be software developers of all kinds using Github.

As well, you can actually build up a really nice portfolio to share with prospective jobs that you might want in the future. You can just kind of direct them to your Github profile, and let them take a look at that for a list of all of your projects and your experiences. And, of course, if you want to use Github effectively, then you should learn to use Git as well.

So that’s a quick rundown of what Version Control, Git, and Github are, and why you should bother learning all of this. Let’s now move to the very first lesson, which will be actually installing LinkIt, so that we can get access to those commands. So thanks, and I’ll see you guys in the next tutorial.

Transcript 3

What’s up everyone, and welcome to the second tutorial in our Git and GitHub tutorial series. This’ll be all about just installing Git (should be quite a short one), and we’re just gonna get our hands on the Git software so that we can actually run some Git commands.

So how do we go about installing it? First, we want to visit this webpage, it’s just git-scm.com, that will give us a chance to download the installer. Once that’s done we can open it up and run through the installation wizard, and then that will allow us to run Git commands through the Terminal or command line depending on which operating system you’re using. So it’ll be a really straightforward process.

Let’s get started by turning to a browser. So I’ve got Chrome open here, although feel free to use whichever browser you guys prefer. What we’re just gonna search for actually is “download git” like so, and we’re gonna go to this first link here, git-scm.com/downloads. We’ll select our correct operating system. I’m personally using Mac OS, so I’ll choose that, although you can choose Windows and Linux if you’re running those ones. So this one for some reason actually doesn’t start for me when it says “your download is starting”. If that doesn’t happen for whatever reason, then you can just go ahead and click on this link here, “Click to download manually”.

This one does work, so it should start downloading in about five seconds or so, and for me, it’ll be a .dmg type file. Once that’s done, I can simply open it up and run through the installation wizard. Once this is done, let’s go ahead and open this up. So I’ve actually already got one downloaded. I should’ve moved that last .dmg to the trash, but that’s fine, we’ll open it up. What we will want is .pkg file. Let’s just go ahead and double click on that. It’s not gonna let me do it automatically, so I’ll just allow that. For you Windows users, you’re probably are not gonna experience this problem exactly, but let’s just go ahead and open that up anyway.

So what that should do is open up the installation wizard like this. So it’s just gonna be guiding us through the steps, we’ll click continue, installation type, and I’m not gonna go ahead and select install. I do have the latest version installed already. But once you do that, it will just bring up the progress bar, and should take you to this option. That will only take a minute or two to install Git and GitHub. After that we’ll go to the summary, it will say it’s finished, and we should be good to go.

So at this point, you will have had Git installed on your system, so you can go ahead and actually move that guy to the trash, that .dmg file. Let’s go ahead and close that up, and then we can just check to see if we have Git installed by checking the version. So let’s just go ahead and open up Terminal. For Mac users and I think Linux as well, it’s called Terminal. For you Windows users, this will be the Command Prompt or Command Interface (something like that).

You will probably want to run these commands as an administrator if you’re running in Windows, just to make sure that you have all the necessary permissions. For you Mac users, or I think it’s the same for Linux as well (haven’t really used Linux too much), if you add “sudo” in front of your commands, this will basically do the same thing; it gives administrative privileges to everything. For most of these Git commands, we actually won’t need to put “sudo” in front of them unless we’re installing or downloading stuff, but just note that that could be why some of the commands might not be working right away.

So to check our version and make sure we have it installed, we can simply do “git –version” like so – this is two double dashes or a double dash before. And as you can see it says 2.21.0. That is the latest release at this time, although if you’re viewing this tutorial a long time after I made it, there may be different versions out there.

Alright, so that’s it, we have Git installed, and it’s ready to use. So the next step will be to actually configure this, so this’ll be just providing default values for a few of the variables that are run through various commands. I’ll end the section here, and we’ll cover that in the next one. So thanks for joining me, and we’ll see you guys in the next tutorial.

Interested in continuing? Check out the full Git and Github – Version Control and Collaboration course, which is part of our Full-Stack Web Development Mini-Degree.