If you've been working on anything programming or CS related, you've probably run into the "git" tool at least once. So, let's try to answer a) what is it for and b) how does it interact with GitHUB?
Let's get some background
Before we jump into how Git works, let's figure out why we want to use it in the first place. Check out the two videos below to learn a little about the concept and motivation behind Git and branching:
https://www.youtube.com/watch?v=8oRjP8yj2Wo&list=PLG3Osgh6aITWY4QCO2BHvxRc03sY65ZzQ&index=2&t=0s
Video takeaways
- When working on a project, you're usually saving as you go. Imagine if your save tool could keep a log of every change you made, along with what those changes represent (ex. "add a profile image," "fix typo in the about us section")
- When working in teams, you may have a bunch of people saving to the same project, or even the same file!
- To keep track of "versions" and the history of modified files, we use Git
https://www.youtube.com/watch?v=uhtzxPU7Bz0
Video takeaways
- Git is a local tool on your machine. In other words, you can save your changes as you go, and only put your changes on the cloud when you want to.
- Git allows tracking of individual user changes. As you might imagine, changes made might overlap with those of other users. This results in a "merge conflict," which we'll learn about soon!
- The git log is accessible to the user with the
git log
terminal command
What's the difference between "Git" and "GitHub?"
This is a classic question, especially since one just sounds like an abbreviation for the other!
First, it is worth noting the one missing link that Git doesn't provide: somewhere to put your code remotely for other members of your team to access. This is where GitHub comes in. You can think of the distinction like this:
- Git is the version control tool that keeps the log of all of your changes. It is also the command line tool used for saving your changes to that log, and pushing those changes up to a remote server, or "repository" (aka all the code in your project folder living in the cloud somewhere)