From web developers to app developers, Git and GitHub are useful to anyone who writes code and works with other developers. So what are they all about and why should you start using them?
View the presentation slides shown in the video.
What is Git?
Git was created by Linus Torvalds in 2005 for the development of Linux, (a clone of the Unix operating system). Linux and Unix are commonly used to run servers, and macOS is based on UNIX. Git is the most commonly used source code management system.
Git is for version control, so it’s called a version control system. It’s free and open-source software that runs locally on your Mac, PC, Linux, or whatever operating system to track the changes that are made to code.
What does Git do?
Git tracks the changes you and other developers make to files. Project files and their change history (because Git is all about changes) are stored on your computer as you work on them. With a record of what has been done (which Git tracks for you), you can revert back to specific versions should you ever need to in the future.
So you can see what’s been done and you can revert back to it if you do something bad that you realized later on you should have done. And how would you remember that change? Well, Git is going to remember it for you.
How does Git track changes?
Changes are tracked as things like adding or deleting code, adding or deleting files. Git tracks those changes made to code at the character level. By looking at what has actually changed in the file (rather than file modification dates), the changes you make to one line and the changes someone else makes to another line can be successfully merged, keeping both changes (even within the same file).
The list of changes is stored in a hidden folder at the root level of your project folder.
What is GitHub and how do we collaborate with Git?
GitHub is a company that was purchased by Microsoft in 2018. GitHub is a place where you can store an online copy of Git repositories. And those Git repositories contains the files and their revision history (all the changes that have been made to them). Having a centrally located place (specifically online) where you can upload your changes and download changes from others, enables you to collaborate with other developers.
How does GitHub work?
Changes you make are stored in your local repository (or repo for short). To share them with other people you upload (or push as Git calls it) your changes to that online repository stored in GitHub. Other people can download (or pull as Git calls it) those changes and Git will apply the changes to their files.
Of course, you can also pull those changes made by others, and have those changes applied to your files. So everybody is uploading (pushing) to GitHub to send their changes to other people. And they are also downloading (pulling) the changes from GitHub, so that they can get the changes that other people make applied to their files. Because Git focuses on the changes, it can upload or download that information (just the change information) very efficiently. It does not need to transfer entire files if they only need to be changed. Of course, if it’s a new file that was created, it will have to download that entire new file. But if it’s only changed, it just downloads the changes and then applies those changes locally. It doesn’t have to re-download the entire file.
Are there alternatives to GitHub?
Sure. There are other companies that do similar things. GitHub is just one company.
One alternative is Bitbucket that’s made by Atlassian and it’s Atlassian’s version of GitHub. GitHub is owned by Microsoft, so it’s just another company offering a very similar type of service. Because Git is open-source software, any company can make an online hosting platform that allows you to upload (or push as Git calls it) your changes to that online platform using Git.
And you can download (or pull as Git calls it) the changes that other people have uploaded. So whatever this online platform is (whether it is GitHub or Bitbucket or similar type of service) people are using Git as a way to track those changes, upload those changes to share them with other people, and download the changes that other people have uploaded to that shared online repository.
How do I use Git? Command Line vs. Desktop GUI Apps
So how do you actually use Git? Well, there are a couple of ways. There are command line ways or GUI (graphical user interface) apps that you can use. Git is software that you access via the command line or terminal (as it’s called on the Mac). That is how the actual software was developed and is used. But there are desktop apps (including code editors like the very popular Visual Studio Code) that provide a GUI (graphical user interface) to use the features of Git behind the scenes, so that you don’t have to type in the commands into a command line.
Microsoft owns GitHub and also makes Visual Studio Code, so it’s not surprising at all that VS Code integrates very nicely with both Git on your local machine, and pushing and pulling to GitHub. A very interesting thing that this integration allows with GitHub and Visual Studio Code, is it on any GitHub repository when you’re on GitHub.com, you can simply hit the period (.) key on that repository. Assuming you have the permission to edit and commit to that repository, it will load a web version of Visual Studio Code right there in your browser, and you can start editing and contributing directly, committing to that repository without having to download any files or install anything. It just loads the web version of your code right in the browser. That’s a pretty amazing integration. That’s not the typical workflow that we use all the time (mostly you work with local files pushing and pulling the changes to something like GitHub) but it’s still a very interesting way to use Git and GitHub. So there are multiple ways you can use Git, it just depending on your personal preferences.
Coding Classes & Certificate Programs
We hope this helped to clarify what exactly Git and GitHub are. If you’re currently enrolled in one of our programs, we look forward to seeing you in class. If you’re not enrolled in one of our certificate programs or classes, be sure to check out our coding classes. From web development, Python, to data science and more, we offer various different coding certificate programs. You can learn live online or in-person in New York City.