What is Git?

Brad Schiff
A free video tutorial from Brad Schiff
Web Developer
4.7 instructor rating • 6 courses • 130,092 students

Learn more from the full course

Git a Web Developer Job: Mastering the Modern Workflow

Learn Git, GitHub, Node.js, NPM, Object-oriented JavaScript, ES6, webpack, Netlify, BEM and Job Interview Tips

14:59:04 of on-demand video • Updated October 2020

  • Build websites using the modern skills, tools, and best-practices that companies are looking for in developers.
  • Write organized, well structured JavaScript and CSS that other developers can easily understand.
  • Confidently apply for web developer jobs knowing you can jump into a dev team and immediately contribute to projects.
English [Auto] Hello everyone in this section of the course we will learn about it. Let's begin with a few questions. So in this first lesson here is what we are going to answer together. Number one what is good. Number two why should we learn good. And number three where do we begin. So we are going to answer all three of these one by one. Let's begin with what is good get get is the world's most popular version control system. But that phrase is just empty words So instead let's talk about what does get do. Why is get so useful and why do so many people love it. So really get just helps us manage our projects files. Now a project could be anything. Let's imagine that we are building a web site so our project would have all kinds of files that would have HVM files C Ss files javascript files images. You get the idea. You've got a whole lot of files. Now the question becomes what does get do that makes managing our files easier. And the biggest one that I want to talk about first is history so history just means that it keeps track of every change we make to our project. Here's an example of why that's amazing. Let's imagine that we adjust the CSSA on a Web site. Maybe we delete a few styles and add a few new styles. We think that everything's great. But a month later we discover that our code changes broked lay out on a few pages. Now instead of scratching our heads and trying to remember what code we adjusted a month ago and involving a bit of guesswork Instead we can have good. Tell us exactly on which day we changed which files and it will even show us which lines of code we added and which lines of code we removed. So this is great. This means you can rest a little easier at night. Now knowing the good has got your back. If you need to revert changes you can if you want to look back and see how a file has evolved over the past year. You can. Nothing is ever lost or nothing is ever final. Thanks to gets history. OK so let's move on to the next reason that people love get and that is collaboration. Now if you've ever tried to create something on the computer with a group of people or a team of people you know that a common concern is trying to avoid accidentally deleting or overwriting each other's progress. To illustrate this let's look at collaboration without get in the picture. So a quick example would be let's imagine we're writing a book and we finished the first one and a half chapters and we send an email to our friend was a word processing file attached and we say hey buddy Here's the first chapter and a half. Do you mind maybe making a few edits and finishing the second chapter for me and then sending the attachment back to me now. The moment you send that email you are frozen you are stuck. You can no longer work on the book yourself until your friend emails you back with the updated book file. Why. Why is that. Well it's because you want to make sure that you aren't stepping on each other's toes so let's imagine that you did make a few edits right after sending that email. What if you edited the first paragraph and maybe fix a few typos in the last paragraph. Well that would mean that your friend then wasn't working with the most updated copy of the book. So then when they send the file back to you both of your copies are out of date. So you would almost have to ask your friend to manually step by step summarize what exactly they change. Hey buddy can you list out the specific changes you made so I can kind of replay those changes to my updated copy and when you do that your friend will probably reply by saying no I will not do that for you. Get lost. Write your friend will be frustrated. They don't want to go through and recap every single change they made and you're frustrated because now you would have to go through both files. Word by word and sort of compare them and see what change and either copy and mushed them together yourself. So no matter how it's sliced. One of you is going to have to do a bit of tedious miserable work of combing through things and merging them together. And that process of tracking the changes and comparing and merging is exactly what good does for us. So that example was just a long winded way of saying that get makes collaboration very easy and it allows you to be more productive when working in a team. You don't need to sit around waiting for someone else to make their changes. You can continue working on your changes and rest assured that when it comes time to sort of merge everyone's changes together so that everyone has the most updated copy of the files get has got your back. Get will take care of merging any conflicts get we'll save the day. Now let's cover one final reason why I think people love get so much and that is something called feature branches. OK so what in the world is a feature branch what does that mean. What is a branch. Well the best way to explain that is to look at an example. So let's imagine that we have an existing web site that we are responsible for editing and updating and making improvements too. And let's imagine that we were just assigned to tasks. Number one we need to redesign the header of the Web site maybe add a new logo change the slogan change the colors and task number two we need to adjust the styling and ordering of the links in the footer. OK so how would things play out if we were not using get. It would probably look something like this. Day one we get started on both tasks but we don't complete either task so we can't go live with our changes. Day 2 rolls around and we continue working on both tasks. By the end of the day we actually finish the footer changes. But our Hetter is nowhere near complete. So now we are in this weird position where we wish we could go live with the updated footer but we can't because our code is all lumped together and if we uploaded the files to the live Web site right now the footer would look great but the header would look broken and we might not finish the header for another week. OK. And you never want one piece of your code holding another piece of your code hostage. So clearly this is not the most productive or efficient workflow. Now instead let's look at the good way of doing things the way of implementing multiple tasks or features. All right if we were using get and we were just assigned the header and footer tasks Here's how it would look. Let's think of our project as a tree. We want to create two new branches one for each task. So we create one branch and name it. Header changes and we would create another new branch and name it. Footer changes when we feel like working on the header. We check out the header changes branch when we make any changes related to the footer we check out the footer changes branch we can hop back and forth between these two branches or between these two versions of our project throughout the day get tracks the branches separately from one another. So it is not a big deal if we finish one feature first. So let's say we finished the footer changes and we are ready to go live with them. All we do is we take that branch that put her changes branch and we just fold it back up into our tree or we merge it into the tree maybe a week later or even a month later we finish the header redesign whenever that time comes. We just fold that branch back up into the tree as well. And that is feature branches in a nutshell. OK so we've answered the question what is good. We know that get helps us manage our files get basically tracks changes which just three big things for us. It gives us history. It makes it easy to collaborate with other people and it makes it easy to work on multiple features at once. Moving on to the next question Why should we learn good. I can't think of a single reason not to learn good. Every job I've had in the last five years I've used get every single day in the developer world. It's just sort of assumed that you know good. So whether you want to become more attractive to employers or you want to fly solo but bring a bit of structure and organization to your code learning good is truly a must. Which brings us to where do we begin. Well the good news is you've already begun you've made it through this lesson which means you know what good is in the first place and what it does for us. The next step is to seek get in. And that is exactly what we are going to do in the next lesson. I will share my screen I will walk through the basic steps of actually quote using yet we can see some of its features come to life. We can get our feet wet together. It's going to be a lot of fun and I will see you in the next lesson.