Git and GitHub - The Complete Git and GitHub Course in 2020 | George Lomidze | Skillshare

Git and GitHub - The Complete Git and GitHub Course in 2020

George Lomidze, Developer / Designer / Online Teacher

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
31 Lessons (3h 5m)
    • 1. Introduction

      2:54
    • 2. What is Git

      4:09
    • 3. How Git Works

      3:33
    • 4. Install Git

      3:21
    • 5. The Basics of Terminal

      6:40
    • 6. Create the First Repository

      5:28
    • 7. Make the First Commit

      7:51
    • 8. Check History

      5:35
    • 9. More About Commits

      7:12
    • 10. What is HEAD

      3:28
    • 11. Git Checkout

      7:35
    • 12. Git Revert and Reset

      10:25
    • 13. Gitignore

      8:46
    • 14. What is GitHub

      4:28
    • 15. Create the First Github Repository

      4:38
    • 16. Push Local Repository to GitHub

      4:14
    • 17. Make Commit on Github and Pull Project on Local Repository

      4:38
    • 18. Pulling from GitHub to Local Repo

      2:54
    • 19. What is Branch

      5:29
    • 20. Branching on GitHub

      6:58
    • 21. Git Merge Part 1

      5:51
    • 22. Git Merge Part 2

      5:30
    • 23. Merge Conflicts

      7:49
    • 24. Git Rebase

      7:40
    • 25. Merge on GitHub

      6:23
    • 26. Merge Conflicts on GitHub

      5:17
    • 27. Fork and Clone

      5:31
    • 28. Contributing

      10:15
    • 29. Add a Collaborator to the project

      7:04
    • 30. Working as a Collaborator

      4:38
    • 31. Protecting Branches

      8:47
19 students are watching this class

About This Class

The Complete Git & GitHub Course

If you create websites, web applications or mobile apps, or in general, if you write any type of code, then, it's always good to use a version control system. This course will teach about one of the most popular and widely used version control systems today.  

Nowadays any professional developer or designer needs to know how to work with Git and GitHub. Git allows you to record different versions of your project and lets you go back in time and check previous states of the project. As for the GitHub, it's an online service where you can share your code to the world and also it allows us to collaborate with different developers. so you if you want to learn those things then this is the right course for you.

The course consists of lots of different topics. We will start from Git basics, where you can learn about how to install Git. We will go through the basics of the terminal, we will create our first local repository, and you will see how to save different versions of the project, as the snapshots, using commits

Next, we will move on and learn about how to go back in time and check the previous states of the project, update them or even delete with help of git checkout, git revert, and git reset.

Once we get some solid knowledge about Git, then we will start learning about the basics of GitHub. We will go through the topics, such as creating the repository on GitHub, connecting the local repository to a remote one, making commits and much more.

Next, we will move on and see how to work with one of the greatest features of Git, which is branching. You will learn about how to deal with branches locally and also, remotely. After that, we will refer to kinda complex stuff. We will show you how to merge branches with different methods, and also, how to deal with merge conflicts

Next, it should be followed by forking and contributing. You will learn about how to copy someone else's remote repository on your GitHub account, how to clone it to your local computer and how to contribute to the original project.

Finally, we will discuss how to collaborate on GitHub. We will go through some really important topics, such as, how to set up a collaboration team, how to define different rules for collaborators and much other stuff. 

Throughout the course, if you have any questions, then you can feel free and post them in the Q/A section, you will get fast and helpful support.   

JOIN US!!!

Transcripts

1. Introduction: if you create websites Web applications for mobile apps or in general, if you're right, any type of code that it's always good to use a version control system. This course will teach you about one of the most popular and widely used version control systems today. Welcome to the complete gets and get. Of course. Hi, I'm George and this is Russia. We are the creators and designers of this course, and we represent code and create nowadays and you off. The professional developer or designer needs to know how to work with kit and get it allows you to record different versions of your project, lets you go back in time and check Prevue states off the project. As for the give him, it's an online service where you can share your coat to the world, and also it closes to collaborate with different develops. So if you want to learn those things, then this is the right course for you. Let's talk about the course content. We will start from get basics where you can learn about how to install get We will go through the basics of the terminal. We will create our first local repository and it will see how to say different versions of the project as the snapshots using commits. Next, we will move on and learn about how to go back in time and check the previous states of the project, update them or even do it. Once we get some solid knowledge about kids, then we will start learning about the basics off Kita go through the topics, such as creating the repository on connecting the local repository to a remote one, making commits and much more. Next we will move on and see how to work with one of the greatest features of kit, which is branching. You will learn about how to deal with branches locally, and also after that we will refer to kind of conflict stuff. We will show you how to merge branches with different methods and also how to deal with emerge. We'll go through those topics both and give our best. Next it should be fellow. By forking and contributing, you learn about how to copy someone else. Remote repository on your have account how to call into your local computer on how to contribute to the original port. Finally, we will discuss how to collaborate on Beautiful. We'll go through some really important topics, such as how to set up a collaboration team, how to define different rules for collaborators on much other stuff, so join us. 2. What is Git: all right. So before we start to discuss and a specific topic regarding get the first question that comes to mind and I have to answer is the following what is get? So as the definition, we can say that it is a distributed version control system. Most of you who is not family with get. Yet those words are not quite clear. So let's first talk about what version control itself is version control. Or maybe sometimes you may hear source control is a system that records changes off your file or entire project, and then you're able to recall any specific version off your project later. In other words, the version control system allows you to go back in time and get previous states off your project. Also, you can compare changes over time. All right, let's use an example to make even clear what version control system is. And why should we use it? Suppose that you're working on a project. I mean, you're building a website, you have done a couple of things, and you already have your first version off the website. Then suppose that you want to change something, and also you don't want to lose your first version off the project. So what can you do? The first thing that comes to mind is to say the first version, Then make a copy off it and work on the second version. Then suppose you need to make another copy than another and someone finally, you might have lots of different versions of the project, and also your hard drive might be folk. You agree that it's not the perfect and efficient way when you work, especially on large projects. So in order to avoid such painful and insufficient way, the version control system was created. So it allows you to make snapshots off the current state off your project, which means that it saves all of those different versions off the project in just one directory. Nowadays, there are a couple of different version control systems, but the most popular one, which is widely used today, is get those days went Web development is extremely fast growing industry in the world and have to be a good and professional work developer. Then you should definitely know how to work with it because you might be working on different projects at the same time, and without a version control system, your working process might be hard and painful. Also, one of the advantages off using git is collaboration. It means that different developers can work on the same project for that. Today, we use mostly Get Hub, which is online service. You can host your project on Get up. It is a terrible place, and everyone can work on the project regarding get help. We'll discuss it later in the course At the beginning of this video, when we defined what it is, we said that it's a distributed version control system. In general, there are two types of version control systems centralized and distributed, or the central light centralized version Control systems have a single several that contains all the different versions of projects so that developers can collaborate. But actually, this type of version control has some down sites. If you do not have net for connection, then you won't be able to get access on versions. And also if for some reason server corrupts, then he will lose all your data. But in case of distributed version control systems, you say versions off your projects locally on different computers and also on sever. And each copy off project is a full backup off all of your data. So if something happens with server, then you still have the full backup off entire project locally. And also, you don't need to have not for connection in order to save versions off your project. All right, so that was a little introduction off version control systems and actually get for now, it might not be quite clear for you, especially when you're not family with get, but it's not a problem. Step by step, you will get solid knowledge and experience in it. Okay? So bear with me and move on to the next lecture. 3. How Git Works: all right. So in the previous lecture, we had a brief overview about what kit and generally, what version control system is. And before we dive deeper into any particular topic regarding get, I'm going to talk a little about how get actually works in order to use. Get for your project. First of all, you have to initialize it. Let's say we have a folder called My Website, in which we store a couple of files index dot html style, don't CSS and also we have a folder for images. So after initialization off, get there will be created a folder named Dots Kit. Actually, how to initialize get You will see it in practice in the coming lectures. For now, I just want to show you the idea how the process is going and how it works. So once this folder is created than the entire directory where that folder is placed will become a repository. Sometimes it's called just Repo. So the report story is a container for a project which you want to track with git. All right, so after that, we were able to track all changes of our project. It doesn't matter if we changed something inside those two files or inside images folder. All the changes will be recognized by get, by the way, as a quick note, I want to tell you that if get initialization happened inside Images folder, then changes outside of that folder would not be tracked because in that case, the repulse story is going to be images folder and not the entire project. Okay, let's consider again the previous example. Suppose that we added a new file to your project. Let's say script O. J S. And we want to set this version off our project in history. We can do that using commit, which actually closer to take a snapshot and said the current state off the project in order to make it clearer. Let's consider some examples using a little diagram. Let's say this line represents history or sometimes it's called a timeline off the development of the project. So imagine that before we take any snapshots or commit something, we're at the starting point. After doing some work, suppose that we want to take a snapshot and save a current state of the project. For that, we have to make a commit after that Let's say we added some JavaScript to our project and made the website dynamic and created another commit. Now we have already saved two versions of our project that assumed that we added some back and functionality to our project and took another snapshot. So overall, we created the history off the development of the project and any time in the future we're able to go back in time and get an previous state off the project we want. Now. I showed just a couple of examples, but in practice, in the real world, you can make as many snap shins as you wish again how to make commits. You will see it in details. Incoming videos. One little thing that I want to mention before we finish this lecture is that this line is called the branch. To be more precise. It is a master branch. In general, you're able to work on different branches. But regarding that, let's discuss later on. All right, see you in the next video in which we're going to set up our kid working environment 4. Install Git: Okay, so it's time to set up the tools. I mean to install git and actually prepare our working environment. Throughout the course, we will need terminal and taxed. Editor. I'm going to use V s coat at the tax editor. In order to download BS code, you have to visit a website called code dot Visual Studio. Don't come and then download installer from here Installation process. Really simple. So I'm not going to go through it. As for terminal, we're going to use git bash which you can get automatically once you install get itself in order to install, get, we have to go to a website called gate dash SCM dot com. Then we have to go to downloads and we have to select the operating system which we're currently using. Besides that, on the right side, you can see here download button which automatically finds out which operating system we're using, and it allows us to download the proper installer. For now, we use windows, So that's why you see here, download for windows. If you're using a mark that instead of windows, you will see here Mark and the same for Lennox, I will show you how to install git on Windows. And if you're using different operating system and if you have some trouble with the installation process, which I think won't happen, feel free to reach out in Q A. Section and we will try to help. Okay, let's click here and download it. Install it once it is downloaded. Let's go ahead and start the installation process. We have to click year next that we need to select the location off. Get folder. I'm going to leave it as it is. So click next, then check the first box. It will L O. R to create the icon on the desktop. But then again, next. Now we have to select the default editor. Forget, as I already said throughout the course, we're going to use obvious code, so I'm going to select it. But if you have your favorite code editor, you can go ahead and select it. So here get offers us to work by default from the command line and also from third party software, so I'm not going to change it. Then click next again next, next, and then finally click install. But okay, it will take a little amount of time Once git is installed, let's click the icon as the sea git bash is opened. It means that get is successfully installed. And if we check its version using the command, get dash dash version but that it will give us the current version off. Get all right, That's it We are ready to start working with Get so let's move on to the next lecture. 5. The Basics of Terminal: All right, So we have successfully installed get in the previous lecture, and now we're ready to create our first repository. But actually, before I do that, I decided to make a video regarding some basic terminal commence which actually are not related specifically to get. So in this video, I'm going to show you how to navigate to different directories, how to create folders, files, how to remove them, and so on. If you already have some experience in working with the terminal them you can feel free and skip this video. All right, let's go ahead and open git bash by default. Our current directory is the folder off the user. In order to check it, we can use the command P W. D. So as you can see, it shows the current directory. Now I'm going to show you how to never guy two different folders for that we have to use the command CD. Suppose that we want to get on desktop for that. We have to type here desktop. So now we are on desktop, and here we can create a new folder. For that, we have to use the command and k d. I R, and then we have to specify the name off the folder. Let's say my folder so is conceived. The folder is created on the desktop. Let's navigate to the folder, right city and the name of the folder. Actually, when you're using git Bash, you don't have to write the entire folder name. You can just type some starting characters, and if you press top, then it will automatically completely name off the folder. All right, in order to go up one directory. I mean, if you want to go back on desktop, you need to use again City than space and double dot. So now we are on the desktop again. We can go up two or more directories at the same time for that unit city, Then double dots slash and then again, double dots. So now we ended up in the user's folder. All right, let's go back into our folder for that. Let's type year passed off the folder. Now it's time to show you how to create files for that unity. Use a command called touch, and then we need to specify the name off the file. In this case, I'm going to create index dot html. So if we check out the folder, then you will find that we have here new HTML file. Actually, you can check out Director using the command ls which will show you all the including falls off the directory. All right. Next, I'm going to show you how to rename the file. For that. We use the command M V. First of all, unity indicate here the older name off the file, which in our case, is index dot html and then we have to specify new name off file. Let's say about us that html. So if we check out directory using ls, then you will see that they filed has a new name. Okay, next thing that I want to show you is how we can copy the file. For that. I'm going to create a new folder inside my folder. For that, we need em que de ir. Let's call the folder new folder than inside it. I'm going to create a new file for that. We can either enter a new folder or weaken do that outside from the folder. In order to do that, we have to write touch the van, the name off the folder. New folder, slash and name off file would say style don't CSS. So if we check new folder using ls new folder, then we will find a newly created file. All right, Now, let's see how we can copy the file. For that, we have to use a command called CP. But before that, let's enter the folder, right CD, new folder, and then used the command CP. Then we have to indicate the name off the file style, don't CSS. And also, we have to specify where we want to cover the file in this case, Supposed that we want to copy it from new folder and pasted outside off the folder. So we need to type here double dots. Let's check the directory off my folder. Right city double adults. And then l s So you see that the file is copied. And if we checked the new folder, right? Ls new folder. Then you will find that the CSS file still exists inside new folder. All right. The last thing that I want to show you is how we can do let the folders and files in order to delete the file. We have to use the command are, um And then we have to specify the name off the file style. Don't CSS. Let's check the directory. You can see that the file is deleted. As for the folders, in order to delete a folder, we need to use the command R M dash R f and then the name of the folder new folder. So if we check, then you will see that folder no longer exists. Let's dilate my folder as well. Go up. One directory, right CD, double dots and then run. Commend our M dash r f my folder. All right, that's it. What I wanted to show you. Those are the basic commence, which you need to know throughout this course, you will see some more Other commence as well once we proceed the course. But for now, I think it's quite enough. Okay, Before we move on, I want to show you one more thing. If you want to clearly window off the terminal, you can run the command clear, or you can use control health. All right, that's it. See you in the next video. 6. Create the First Repository: all right. So once we introduced to some basic terminal commands Finally, it's time to create our very first get repose story for the fall. It's open git, bash and navigate to the desktop using city tasked up, I'm going to create a new folder for that, we need em que de ir. Let's call this folder. Get project. Now, I want to open this folder with V s code. We can either open it manually by right click like so, or we can use the terminal for that. We need command code and the name off the folder Get project. So as a conceit, our folder is open with BS code. By the way, if you are inside the folder and you want to open it with B is code, then you just need to type code space and dot All right, let's place editor and terminal side by side in order to make our working process more convenient. Next, I'm going to create a new file. We can do that from the terminal, let's and through the folder right city, give project and create a new file using touch at indicate name off the file indexers. HTM Oh, Also, we are able to create a new file from the editor. We can either click the icon here, or we can create a new file using right click and then create file. Let's call this pile style CSS. All right, so our project consists of two different files, but at this point, it's not a git repository. As remember from previous lectures, the first thing that have to do in order to create git repository is get initialization. For that, we need to use our very first get command, get in it. So, as you can see, there is created a new folder with the name DOT skit, and also our files have changed their color in our editor. For now, they are green. If you don't see don't get folder envious code by default, then you should fix it from the settings, so you need to go to settings. Then you have to click cola braces, and then Jason file will be opened. From here, we can add the following code, which will allow you to display. Don't get folded, so let's go ahead and insert it in your settings file. If for some reason, folder still is not displayed. Then just restart. Your V is code, and it should be displayed. Okay, if we check our gift project from File Explorer than the newly created get folder will be heating by default in order to make it visible, weaken, go to view, and then check hidden items. So now you can see that the folder is visible. All right, let's go back to V s code. If we drop down the gate folder, we will find here some other folders and files. This is the source of gate, but we're not going to go through them because we're not interested in them. We just need to learn about how to use skeet and how to work with it. All right, we said that after a good initialization, files have changed their color, but we didn't say why this happened. So now our files are untracked. Basically untracked means that get seized files that we didn't have in the previous snapshot. For now, we don't have any snapshots because we didn't make commits yet. The only step that we went through Watts Gate initialization Also, you can see on the right side off file names, The letter you which actually means that those falls are untracked. Besides that, in order to prove that those falls are in trucked, we can use another git commands which actually will be used frequently throughout the course. And this command is get status. It gives us some useful information. It says that we are on the master branch. We don't have any comets yet and also it says that we have some untracked files index of HTML and styled CSS. You can notice that at this point those thoughts have a red color. But once we go further, they will change their color in some cases. All right, that's it about creating the first get repose story. Before we finish this lecture, I want to show you one more thing. We have already used some get commence. We will be using other get commences well throughout the course. And if you need to get some more information about get commence, you can use get help for that. You need to specify a command that you want to get information about. That's I get in it and then we need dash dash help In case of we knows a new top will be opened in the browser. You can read this article, and if you're using Mark or Lennox than this, information will be opened inside the terminal. All right, that's it. For now, we have seen how to create get reports story. We used some give commence, and now it's time to move on to the next lecture. 7. Make the First Commit: all right. So in the previous lecture, we created our very first repository. And now in this video, I'm going to show you the whole cycle. I mean, beginning from untracked files to making commits. So there are several faces which filed or project goes through In general, remember that each file in your working directory can be in one of two states tracked and untracked tracked files are falls, which were in the last snapshot. As for untracked files, they are any files that were not in your last snapshot if we consider our example. I mean, our little project, which we created in the previous lecture files index dot html and startled CSS are untracked files because we didn't make any snapshot yet. In order to begin tracking a new file, we used the comment get at and then we should specify the name off the fight. Once we run this command than this file will be staged. So in general, when file ends up in the staging area, it means that it's ready to be committed in order to make commit, we should around the command, get commit desh em, which allows us to create a message with a little description. So when you commit the version off the file at the time you ran, get at is what will be stored in the historical snatched. All right, you were able to change a file that was, although detract and when you do that, that it will be modified. So it means that followed that was tracked has been modified in the working directory, but it's not yet staged. In other words, in history there is stored the version off the file, which we added it to the staging area. Firstly. So now if we want to make a snapshot with a modified version off the file that, then we have to stage it again using get at command, and after that the file should be ready to commit. All right, so this is a whole cycle on those of the main faces. Which file goes through Now it's time to go to our terminal and see all of the stuff in practice. So now we are in our folder in which we have to untracked files. As you already know. The next step, which we have to do, is to add those two fathers to the staging area. Before that, I am going to insert some basic stuff into those two fouls. Let's just create a basic structure off HTML document. For that, we need to place exclamation mark and pressed up. Also, it's open style. Don't CSS file and just change background color for the body element. Let's make it threat. All right. Now it's time to add those fathers to the staging area for that. As I already have shown, we need to use the command, get ad and we have to specify names off the files index of HTML and styled with CSS. So now those files are staged and if we check the status using git status, then you will find that files are no longer read. They have changed their color now their greed and also we see here the text no commits yet and changes to be committed. So it means that those two fouls are ready to be committed. Also, we see here text which is saying that we can use command git RM dash dash cash in order to on stage the first. So if you run this command for one off the files, let's say for index dot html and then check the status again. You will see that in Excel html is again untracked. So remember that when you want to get with off the file from the staging area, you need to use the command git RM dash dash cashed with the file name. Okay, let's add again indexed LH demo to the staging area around the command kids at in Excel html. All right, so now it's time to make our first commit For that, we need get commit, and then we have to create a message which will have a little description off our snapshot . So we need to dash Cam and then inside quotes. We can write some text. In general, this tax should be short on descriptive. I'm going to write here initial comic. So once we press enter that we will get the message saying Please tell me who you are and then down below, you see that we have to run some commence. Actually, it happened because we need some configuration. We have to specify the name off the user and the email get it requires this information because it saves in history to whom belongs particular comment in other words, it records Which developer made this new options? So we have to run kids kind of fig. That's dash global, That user don't name if you want to specify your name with two or more words that you need to enclose them within quotes. But if you're going to write just name with a single work, then you don't need quotes. All right, I'm going to write you some random name. Let's say, John, after that we have to configure email. So we need a similar command. By the way, if you want to use previous commence again, but then you don't need to type them over and over again. You just need to press the up arrow key and you will get the previous commenced. Let's change the name and write an email instead of it, and that he's a fearsome Tommy email. Let's say John at Gmail. Com, Of course, you can use your own email. It's up to you. All right, so now we can make a commit. But before that, let's make sure that all these configuration stuff is done correctly. I'm going to check the user name and the email for that. We have to run. Get config. That's dash global user dot name. As you see, we got here named John on the same weaken due for email. So as you can see, everything is set up and finally were able to make the committee for that. We have to write, kids commit dash um, and then the message in issue commit So now. Eventually we made our first commit and in history there is recorded the current state of the project. When we proceed and continue working on the project, then in the future, every time will be able to go back in time and use the state off the project. Actually, you will be able to see all of the stuff, throw the course, and before we move on, I want to talk a little about commits. You may think that once we make a snap shirt, then we start the copy off the files for the project. But that's not right. Every time you commit, get basically takes a picture off what your files look like at this specific moment, and it stores a reference to that snapshot. That's the huge advantage off using kids. All right, for now, I think it's enough. We have just learned about the faces off the cycle. I mean, what is staging area? Modifying the files? Also, we made our first commit, and now it's time to move on to the next lecture. 8. Check History: all right. So in the previous lecture, we made our very first commit. We have learned about how to do that. In this video. I'm going to make some other commits, and I will show you how to check the history off the commits. So first of all, I'm going to check the status off our repository. Let's run get stages. As you see For now, we have nothing to commit, and our working tree is clean. Let's go ahead and modify slightly our files. I'm going to create a new element inside an HTML document. Again, you don't need to know about how HTML and CSS work they may think here is to change and modify the files. So let's create H one heading elements with some text. Let's say get is awesome. Then I'm going to add some styles into style that CSS file. Let's select H one heading elements and change its phone size. Make it 40 weeks. All right, so we have made some changes in both off the files. Let's check the status. So is the seat. Both falls are modified, they have red color, and the next thing that we have to do is to add them to the staging area. You already know how to do that. We have to use the command. Get at. Actually, we can either indicate both far names in one command like so. But imagine that we're working with a large project and we have to add tense off falls. Then typing file names will be really hard and painful. So in order to avoid this, we can use just dots instead of the file names and all the fast will be added to the staging area. Let's check again the status. So now both files are added to the staging area, and the next thing that have to do it to make the commit for that we have to run the command, get commit, then dash and and now we have to ease of the message. Let's say added, heading. All right, so now we have to commits in the history. I'm going to create one more commit. Let's create a new file and colleagues script thought Js So what do you think? What will be the state off the newly created file? I mean script Js Let's go ahead and see it in order to check that Let's run get status. As you see it's an untracked file because it doesn't exist in the last snapshot. In order to start tracking this file, we have to add it to the staging area. So we have to write, get at and the name of the file script or Js. Now it is staged and next we have to make a new commit for that. We have to run, get commit, Dash, Um, and as the message that's right at Js fought. All right, so at this point, we already have three commits and now I'm going to show you how we can check the history off our commits. For that, we have to run the command, get lug. As you can see, we got here three commits. Let's go ahead and describe What do we have here? The first thing that we see here is some away characters which actually is the unique identifying off the commit then we see had master the head is something like Pointer. And actually we will discuss it a little bit later. Next we have an author. It shows us the name and the email often author off this committee as remember, we added those name and email while we were trying to make our first commit and get has required some configuration. Next comes the date off the commit. And finally we have the message off the comet, as he noticed the first commit that we see here is actually the last one that we have just made. Okay, then we have second commit. It shows us the state of the project when we added heading and the last one represents our very first initial commit right. So that's the way how we can check the history of commits. For that we have to use Git Log Command. Actually, there is another way to do the same. Get law gives us some bunch of information, and if you want to get this information in kind of a concise way, then we can run this command with flag dash, dash one line. Now the information is much shorter. Each committee's Joan in one line the identify where is represented with just 1st 7 characters, but a number off the characters is enough to use the identify ire in different commence. Also, we no longer have here author and date and finally we have here just the message off the committee. So you are able to use both ways. Sometimes when you have lots of commits than using that shorter way is more convenient. All right, so that's all about how we can check the history of commits. For that, we have to use commands. Get luck, or it's shorter way Get locked. Dash, dash one like. Okay, see you in the next video. 9. More About Commits: All right, so we have already made a couple of commits. And in the last lecture, we have learned about how to check the history of commits using Get luck. Commence in this video, I'm going to show you a little bit different way off, making commits. Let's go ahead and create a new element inside an HTML document. Let's create a paragraph with some dummy Laura Me Ipsum text. Let's save it and check the current status. Rank its status. So we have modified the index dot html file. Let's go ahead and add it to the staging area. Right, Get at and the file name index of HTML. Let's check again status So the file is ready to be committed. And now I'm going to show you how we can do that in kind of different weight. We can run, just get commit. And once we press enter, then the new file will be opened in our text editor. So this file is opened envious code because we have chosen it as a default tax editor when we have bean installing git. This file is called commit added message. Inside that file there a couple of comments and now here we can insert a message off the committee. So basically, we're doing the same thing as we do in case off Desh and Flak. But in this case, we use a text editor instead off the terminal. Besides that, you can notice in terminal a little hint saying waiting for your editor to close the file. So once we insert here the message, let's say added paragraph, then save and close the file. Then the committee will be automatically made. What you see, actually here in the terminal. If we check the history using get log de stash one line, then we will find that the new committee is added. All right, now I'm going to show you what happens if these code is not set as a default text editor. In order to unset it, we have two different ways. First, we can open a file called dot Get, come pick in our text Editor. This is a file which stores some configuration stuff. I'm going to open it and show you. Actually, you don't have to do that. You can just watch this part. So, in order to open the dot git config file, we have to run the following command. First, we have to indicate the name off the actor. In our case, it's code and then it should be followed by the name of the file. Before that, we have to type here till the sign it allows us to navigate to the folder off the user. Then we need slash and the name off the foul dot git config. All right, So, as you see, the foul is open Envious coat. At first, I'm going to mention that the location off this pile is not our project folder. It is placed inside the folder off the user because it is a global fall and it has access on every get reports story. That's why we use Dash dash global flag with the get convict command. Okay, so we have here some stuff and down below, You see that the editor is set as coat and also we have a name and the email off the user, which actually we added during the configuration were I able to unset before editor from here. And for that we just need to get rid off those two lines. But instead of deleting them manually, I'm going to use an easier and more professional way we can around the following command gets config Dash dash, global dash, dash onset. And now we have to specify that we want to unset co editor. So once we press enter, then you will see that the two lines are automatically deleted from git config file. Now let's make a new commit for that. I'm going to modify one of the files. That's a script Js. Let's create a variable incited right cost a equals two 15. Actually, I'm making little changes just for demonstration. I'm not going to waste time on coding, but in general, in the real world, making commits on such little changes is not recommended. Okay, let's check the status So you see a script Js file is modified and now we have to add it to the staging area. So let's run, Get at script out Js. Let's check again stages so the file is added on. It is ready to meet committed, so let's go ahead and run, get commit. Once we press enter, then we will get a new screen in our terminal. Actually, this is a default get editor, which is called him here we have some commence and were able to insert your message for the committee for that. At first we have to click I, which stands for insert, and then we will be able to type the text. Let's say created variable. So once we insert the message that in order to close this editor and go back to our terminal screen, we have to press escape, then shift column and in order to say the text, we have to type W. And finally, in order to quit, we have to press cute. If we don't want to save, then we can just type Q. And the editor will be close. So, as you see, we're back to our working screen and also commit is made in order to check that. Let's run, get log, dash, dash one line so you can see that the comet is made with a relevant message. All right, so that's it. What I wanted to show regarding making commits before I finish this lecture, I want to set back visual studio code as the default tax enter For that, we have to run the command git config, Dash Dash Global, then court DOT Editor then inside quotes. We have to write coat and we have to adhere the flag dash, dash, Wait, because it will l o get to wait until the message is created and file is closed. All right, so after that, the U. S. Code will work at the default text editor. Let's take a little break here and move on to the next lecture. 10. What is HEAD: all right. So we have already learned some basic stuff regarding gets. And now in this section, we're going to be talking about how to undo or discard the things and get throughout. The section will be referring to some important commence, such as check out, revert and reset. Those commands alot us to go back in time and check older versions off the project. I mean different snapshots which we have already made, and also they follow us too many polite on commits. Okay, before we move on and start talking about those commence. First of all, I want to refer to had Pointer, which you have all of the scene a couple of videos ago. All right again, I'm inside our working get project folder. Let's display all of our commits, which we have made so far using kids luck Dash dash one line. So as the sea Overall we have five different commits and with the 1st 1 which in fact is the last commit we see in parentheses had which is a pointer. And also we see Master, which is a default brunch. The brunch itself is a timeline off the commits. So by default had points to the last commit. But if we go back to any off the previous states off the project then had will point to the relevant committee and you will see it's a in order to prove that had points to the last commit by default, we can run the following command gets show all right and then had. So, as you can see, we got here the last commit with a bunch of information. I mean, with Author Date and the message. Besides that down below, we see some other stuff to be more precise, the difference. But for now, I'm not going to refer to eat because it's a subject off different sections. Now I just want to show you how we can use the head and this guy's had perform the same job as I d off a committee can do. I mean, we can run the same gets show command. And if we pass here the idea of commit instead of head, by the way, when you work in git bash and you want to copy something, you just need to still like the text, and it will be automatically copied. So now you see that we got here the same result, so we're able to use had instead of I D. But it's interesting. What can we do if we want to show up? Other commits using the head for that, Let's at first clear the window that look again commits using git log, dash, dash one line. And now let's see how we can access other commits using the head. Let's say on the 2nd 1 for that we should run, get show that had which should be followed by till the sign and then we have to type one. So we wrote here one, but it points to the second committee and the same way works had till the 23 and so on. So if we press enter, then the second comet will show up. Okay, so that's all about the had pointer. We will use it in the future throughout the course. For now, let's stop here and move on to the next election 11. Git Checkout: all right. It's time to start talking about undoing things in gets. As we said in the previous lecture, there are three different commands, which hello us to undo things on. The 1st 1 that I'm going to talking about in this lecture is get check out. So with help off this command were able to unmodified files. Also, we can go back in time and check different states off our project. It also allows us to move between different branches. Okay, let's go ahead and at first see how we can unmodified files before that. Let's modify files and make some changes in all of our three files. Let's create a span element inside paragraph with some text that say hi there. Then go to style. Don't CSS file Select paragraph and change its color. Make it green. And finally, let's open this creep. BoJ's file and create another variable cost be equals 100. All right, so we have modified or three files. Let's check the status. As you can see, all of our falls are modified. Now suppose that we accidentally made some error and we need to unmodified the fun. Let's say script or Js for that we can use the check out command which actually is shown here as well. So if we run gets check out and the file name Script Js, then the second variable that we have just created will be gone. And also, if we check again, the status screamed. The Js file will be no longer shown here because now it is unmodified. So you agree that it's really useful. If you want to a modify all the files at the same time, then you can run get checked out with dots, by the way instead off a dot you can use an asterisk as well. Okay, so if we check again the status, then you will find that our working tree is clean and all the changes that we made are discarded. Okay, Another job that get check out can do is to go back in time and check the previous states off the project. Unlike other commence such as revert and especially reset, check out is the safest one. Because we check out, we cannot change or delete previous commits. All right, let's look commits using gets look dash, dash one line Suppose that you want to go back in time and check out the state off your project where we added having in HTML document. I mean, let's say we want to check out our project on Lee second committee. In order to do that, we have to use get check out and then we have to specify the proper I d off the committee. So let's copy i d and pace it you. So once we press enter, we will get the previous state off our project. As you see script, OJ's felt no longer exists. And here just the tap is opened. You can see here in parenthesis that file is deleted from disk. So we just need to close these Top also in HTML file would have just having element and install dot CSS file style for a program is removed. Besides that, you can see here in the terminal the following text you are in detached had state. It means that had pointer no longer refers to the last commit Also you can see down below that instead off the master here is displayed the i d off the committee. All right, let's luck commits right gets blawg Dash dash one line as you see just the 1st 2 commits are displayed. It doesn't mean that the rest off the commits are dilated. We have just moved back in time and we are in the previous state off. The project, of course, now had points to the committee on which we currently are. Okay, so that's how we can check the previous state off the project in order to go back. We need to run, get checked out, Master. So you see that script? RJ's file is back on. If we run again, gets look, dash, dash one line, then all our commits will be back and had will point again to the last committee. So check out is very safe because it is a read on Lee. You cannot change or added previous commits, and now I'm going to prove that let's go back again to the previous commit Let's say to the 2nd 1 right, get check out and paste your I d. And now let's try to make a commit. Let's add in this Talat CSS file color blue, then check the status so the file is modified, and in order to add it to the staging area, let's run, get and and the file name styled up CSS. Then again, check the status. It is green, so it is staged. And finally, let's go ahead and make the committee. Let's run kids commit desh Um, And right here the message test committed. All right, so let's lock the commits Ron gets log, dash, dash one line You can see that the committee is at it, but if we go back using, get check out muster and then lug commits using gets look, dash, dash one line, you will find that here. We don't see that newly created commit. And also, if we go back again to the previous state using get checked out with I d And then if we run , get luck Dash Dash one line, you will find that commit no longer exists here as well. So it means that check out command is just a read on Lee and were not able to change added to commit or at the new one in the previous state. Actually, for that we can use other commands like revert or reset, which we will discuss in the coming lectures. But anyway, if you want to create a new commit in case off. Check out. You can do that by creating other branches, which you will see later in the course. All right, that's it about Get check out. Next. We have to discuss how to undo things. Using gets revert. And for that, let's move on to the next lecture. 12. Git Revert and Reset: in the last lecture, we talked about the kids. Check out this comment also to unmodified the falls, and also it helps us to go back in time and check the state of the project on any commit we want. As remember, key check out is just a read on the command. You are not able to undo things or create a new commits in previous states off the project . Now we're going to introduce you to other commands which alot are to undo things and get the first commander I'm going to talk about is get revert. It is used to undo the changes to your projects. Commit history, certainly Revert Command takes the specified commit inverse the changes from the commit and creates a new revert commit That's gotta haven't seen practice how it actually works. At first, let's log the committees to re using get a log, dash, dash one line. So, as you see overall, we have five commits Supposed that we want to undo the changes from the committee in which we added the paragraph in the HTML document. So how can we do that? We should run the command, get revert and then we have to specify the idea after commit. So it's copy and paste it you. Once we run this command event, a new temporary file will be opened inside off our text editor. You can see here Revert with the message of the committee. Actually, we're liable to change this message, but for no, I'm going to live it as it is. Then down below, you will find that these Roberts commit and we have an i d off the committee, which we're going to revert. So now we have to close this file and once we do that, then the paragraph will be deleted from the HD more thought. And also, as we already said, the new committee will be made. So if we run gets look, dash, dash one line, then you will find that the new committee is made reverts Added paragraph. So we have gone back in time and undid the specified commit. Actually, between those two commits, we have one commit created variable. If we checked descriptor Js file, you will find that the variable still exists. It means that when you use git revert command, you don't touch any off the changes which was made in another commit. You always undo this specified commit. So this picture is very useful because sometimes you may have some mistakes in your previous specified commits and get revert allows you to fix those mistakes without changing any other commit. All right, that's my moment. Talk about Get reset, which actually is known as the dangerous and unsafe command, because it can permanently delete your work. So you should be careful with get reset. Let's go ahead and see actually, how this committed works. Before that, I'm going to add a couple of committed to our project that's create a simple navigation in HTML document used not element and then inside of heat insert least with couple off least items again. If you're not familiar with those different elements and in general with HTML or CSS or JavaScript, it's not really a problem. You can feel free and use just the text files, or even you can work with office documents like Word, Excel and someone. We just need to make some changes in our faults. All right, let's go ahead and at the index dot html file to the staging area for that we need to get at and they finally then check the status so the fall is ready to be committed. Let's make a new commit with a message, added navigation. Then let's go ahead and look to commit history. So here we have our last commit No, I'm going to make another one. Let's go to the script a Js file and create some simple function. Then, at this file to the staging area, we need get at script Archer. Yes, and finally make the commit with the message created function then logged the history. So now suppose that we want to delete those two commits, which we have just make. So how can we do that? That's the moment when get reset comes in, we can run, get reset, and now we can use three different flex, which actually act in different ways. The 1st 1 is Dash Dash mixed, which is a default flag. It means that if we run, just get reset than the mixed flag will work anyway. Besides that, we have soft and heart. I'm going to discuss all off those three flags. Let's start with mixed. So now we have to indicate the idea off the commit in this guy's when we want to delete those two commits. We have to specify the idea off the previous committee. I mean, the idea off Revert added paragraph. So if we run this command and then check the history, you will say that the last two commits are removed. But it doesn't mean that we remote physically the navigation and the function from our files. As you see, both of them still exists. So it means that we have just removed the commits from the history. If we checked status, you will find that the index dot html and this creep the jays falls are unstaged, so they no longer exists at the staging area. So in order to discourage the changes from the files, I mean to remove them permanently, we can run, get check out, then dots. Now, as you see, we no longer have here the navigation and also the function and the jobless we find If we check the status, then our working treat will be clean. So that's the way how get reset mixed works. It just removes the commits from the history and also it onstage. Too far from the staging area, they end up in the working directory. Let's go ahead and describe other flags. Let's I soft first of all lovely history. Now suppose that we want to remove the next to commits. I mean Revert added paragraph and created variable. As we said, Now we're going to use the flag soft, so let's rank it reset. Dash, dash soft. And then we have to specify the I d. Let's love the history again. As you see, commits are dilated, but like the previous case files are not change and the jobless hoof always to have variable. The difference between the soft and mixed flats is that in case of soft the files are maintained on the staging area. They are not unstaged. If we check the status, you will see that both files are green, so it means that they are staged. Now if we want to make the changes in the files, we have two onstage. Both of them for that we have to use gets reset. So in other to on stage, both files will have to place here dots. And now if we check the status files will be on stage. And finally, in order to make the changes we have to use again. Get check out with DOT. As you said, the variable is deleted from the JavaScript fought also as conceived. The paragraph is displayed back, which maybe is a slightly unexpected. It happened because we in fact deleted Revert added paragraph. Therefore, the commit added program is no longer indeed became so That's the way how get reset soft works. So both flags. I mean mixed and soft removed, he commits. But the 1st 1 on stage, the file from the staging area. As for the 2nd 1 it maintains them and doesn't onstage as is so in both cases, we have gone through a couple of steps in order to make the changes in files and not only remove the commits, but if you want to remove the commit and also make the changes in far simultaneously, you can simply use gets reset with hard flak. That's lovely history again. So now suppose that you want to delete all off the commits except the initial one, and also at the same time you want to make the changes in files as well. For that, we have to run, gets reset, dash, dash heart and then we have to specify the I. D. So, as you see, the changes are making false. The heading is removed. Also, this cryptologist file is deleted and we have the state off the project from the initial commit. If we check the status, you will see that the working tree is clean. And also, if we love the history, we will get just a single initial commit. All right, so that's the way how gets revert and get reset work. I know that it might be a little bit hard to grasp. So if you feel yourself confused if anything in this video is not clear, then I recommend to re wash this lecture and test things on your own. Okay, that's it. See you in the next video. 13. Gitignore: Okay, so we have all been learned about a couple of things and get I mean, how to track files, how to add them to the staging area, how to make commits, and also how to undo things. So far, I think now is the perfect time to talk about how to ignore files or folders from tracking . I mean the files and folders, which should be recognized by get when you work with projects. You might have some order generated files or different folders, which you don't need to track all the time, because it might slow down your working process. So we need some solution which will follow us to ignore those thoughts for that in get we use a dot it ignored fight. Actually, it doesn't have any name. When you want to create it, you just need to indicate the extension dot Get signal. Let's go ahead and create this fault and see actually how it works. Now let's check the status. So for now, we have just one on trucked file dot Get ignored. Suppose that we should have some text files, which we need to ignore. Let's go ahead and create them. That's a text one, not txt and tax to dot txt. As you see, those newly created fuss are green and also we see here letter you which actually stands for untracked. So if we check the status, then you will find that we have three untracked files. So now we need to specify those text balls inside of the get ignored front. For that, we just need to indicate the parts off the foul. In this case, text files and get ignore are placed in the same directory. So we just need to specify the find names actually, before the names we need to place forward slash, followed by the name of the father. If we save, then we will no longer have a green color with the letter you. It means that get already ignores those two falls. If we check the status, we will get just one on truck file, which is the get ignore file itself. So again, once you specify the falls and give, ignore, then get will no longer recognize those falls. In order to prove that again, let's modify those text files and also create a new element in the index of HTML file. That's place your hello there. No. If we check the stages, we will get just one modify file, which is in except html. And also one untracked files dot get ignored. All right, so that's the way How? Get Ignore works. Now I'm going to show you one important thing. Suppose that we want to ignore the index of HTML and style dot CSS files as well. For that, we have to put them in, get ignore file. Then let's make some changes in both of the files. I'm going to create paragraph with some text and then insulted CSF l Let's create style for h one heading out. No, If we check the status, then maybe unexpectedly, those two files will be steel modified. So in this case, get didn't ignore HTML and CSS files. And the reason of that behavior is that those too fast have bean other the modified before we created that get ignored file. So in order to fix that, we have to delete the cash from the history. For that, we have to run the following command we need get R M, which stands for remove than dash are cash and in order to include all the fast when it thought so. Now we clean the cash, and I want you to know that we just clean the cash and defaults themselves are still here. So if we check the status, we will get here just the one on truck file. So now the HTML and see as it falls are no longer recognized by it. Now, as you see, changes are ready to be committed. Let's onstage falls from the staging area. We need to run kit reset dots. Let's check the status. So now files are modified. And finally, when it get check out dot So if we check the status again, then we'll get only one contract file. Dots get ignored. Actually, in the real world, it's recommended to created dot get ignore file once you create the repository in order to avoid such unexpected things. All right before he finished his lecture, I'm going to show you a couple of things. Let's create a new folder. I'm going to call it Odo. Jenna files. I mean, owner generated files. Then inside this folder, let's create several text files. Now suppose that we want to ignore all those text farts for that we have to indicate them in get ignore file. Before we do that, I'm going to show you how we can make the comments and they don't get ignore file. We just need to place the pound sign followed by the text off the comments. Auto generated fuss All right, so let's go ahead and specify the find names first of Well, we need to indicate here the folder main, although Gen falls, then slash and then the file name eight dot txt. Let's do the same for the rest of the falls. I'm going to duplicate this line and just change. Name off the txt fast. Let's check the status. So, as you can see, all three files are ignored. In this case, we have just three off them. But sometimes we might have hundreds off such falls and that indicating the file names individually will be really crazy. Right? So what can we do here in order to solve this problem with just one line of code we can use and asked the risk instead off the findings. Now, if we check the status, who will get the same result so it can simply use this technique. Okay, Now I suppose that we have another fall inside of this folder. But in this case, with a different extension, let's say about thoughts HTML and we need to ignore a gang, just the text fast. So in that case, we still need to use the asterisk, but it should be followed by the file extension dot txt. So if we check again this aiders, then we will get here dot Get ignore as the untracked file. Also folder origin falls. But it would take a look at this sideburn. You will see that only about the HTML file is untracked. All other txt files still are not recognized. You okay? That's it about it. Ignore. It's really useful and half feature on you will be using it quite frequently when you will work with your own projects in the future. Once we prepared the getting nor file, let's make the commit at first added to the staging area. Then make the commit with a message prepared, get ignored five. And finally check the he three Ron gets Look, dash, dash one light. Okay, that's it. See you next time 14. What is GitHub: So we already have learned about the basics of kids. We have gone through some important topics. We know how to create the repository, how to make commits and also how to go back in time, check the previous states of the project and on do things. So I think we have quite enough knowledge to move on and introduce you to keep, huh? First of all, let's find out what kid hub is. As a definition, we can say that Get Hub is an online service where you can share your code or files in order to collaborate with different people. In other words, it is another computer on which every person who is working on a specific project will have access. For example, you can imagine a Web developer team who wants to build a website, and everyone has to update their coats simultaneously while working on the project. In this case, get help allows them to build a centralized repository where everyone can interrupt with each other and manage the code so eventually the final product will be built on it. Online repository. All right, let's consider a difference between get and get help as usual, people are a little bit confused regarding the difference between get and get help. Actually, as theology, no get is a version control, too, and it closes to manage the project locally. Additionally, we can say that it closes to fetch the data from the central sever or push data to it. As for the get up, it is a hosting platform which allows you to host a repository on a remote server. Besides that, we can also say that get help is a user friendly public platform with a nice visual interface, and millions of users are sharing their projects to the entire world. All right, we can talk a lot more about get up and its features, but I think for now it's not necessary to overcomplicate. Things would be better if you go through the features off, get hopes that by step in the common lectures. So if you're an absolute beginner with get up, then I will show you how to use it. You need to create an account on get hub, so let's get started. First of all, we have to go to the website called Get help dot com, where you can find a very simple registration for you just need to type here your unique user name, email and password. Once you feel up those input fields, then you have to create this green. But again, the registration process going to be very simple. So I'm sure that you won't have in trouble once you sign in first, you should click verifying, and he will get some funny creature here, which you have to rotate once you do that. Then click done. And after that we'll move on to a get help. Welcome page. Now we have to go through some steps. Here we have two different options to choose a subscription. The 1st 1 is free. As for the 2nd 1 is a pro option, which will charge you with $7 per month. Actually, the main difference between those two options is that in case off the free option, you are a low to have on Lee, three collaborators for a private repository. As for the second option, you don't have any limit for our course. The first option is absolutely enough, so I'm going to choose it. We don't need to check any of those boxes. Let's just click continue so here, we have to answer to different questions. The 1st 1 is about the level off programming experience. Suppose that we are new to programming. As for the second question, let's check the second option learning kit and get help. Leslie. These field Empty and click. Submit. Now we need to verify our email account. For that, you have to visit your email account where he should get the email from. Get up. Once you click verifying email address, you will get to another welcome page. All right, I think for now it's enough. Let's continue in the next ledge. 15. Create the First Github Repository: So in the last lecture we created an account on G Top and now we're going to explore the website. I mean, some of its basic parts, and then we will start creating our very first repository. Currently, we're on the welcome page of Get Hub. Here we see two different buttons, read the guide and start a project. And actually, before we create our first report story, I'm going to show you how the existing repositories look like you can either check out some reports stories on the right hand side of the page, get help, shows us some random repose, or you can just search for them from here. I'm going to search for Let's say, react so he would have some results regarding React. Let's go to the 1st 1 which is the actual repository Off reacts library. So now we're on the page off reacts repository and actually all other repose look in a similar way. It would have different files and folders which react library can see self. If we click one of them, we will be able to see some coat. Here we can see the green button, which allows us to clone or download the entire source at the top of the sore spots, you see a couple of different tops. The 1st 1 is comments. Overall, we have more than 11,000 comments. If we click, it's then we will be able to explore all the commits which were made so far as can see each commit has its own I d. Similar, which we're so in. Our province lectures next, he commits. We have branches, which for now you're not family with. Also, we have here releases off different versions of react that it is followed by the number of contributors. Those are the people who actually work on developing this library. All right, let's move on and describe some other things here at the top of this page, you see that this repo is used by more than two million people. Next to it, we have watch, and if we drop down it, we should see a couple of options. If you click watching for example, then you will be able to get updates regarding this repository. Also, you can give a started and someone for now I think it's enough. Let's go ahead, check out our profile. You're able to customize your profile, you can add your bio. Then we have a couple of input fields for your company name for location and website. Also, you're able to change Avatar and set your profile image. All right, Actually, you can go ahead and explore all those things on your own. You can play around and check out different pages in order to get family or with gate up website. Let's go to the main page and start creating a new report story. For that, we have to click. Either they start a project bottle or you can click here the link on the left hand side off the page. Create a re positive. As you see, we moved to a different page where you can create a report we see here are user name, followed by the input field in which you should enter the name off the report. I'm going to call it the exact same name, which we use for our local or post story. I mean gets project. Then down below. We have another input field for description, which actually is optional. Let's interview a little description. Let's say this is my first keep top repository then down below. We have two different options, public and private. If it choose public, then anyone will be able to see your public reports story. But you will choose who can commit. As for deprived to report, you're able to choose who can see and commit to this report story. All right, that's the life public. Next, we can initialize this report with a read me file. Bye for now. I'm not going to do that down below, we are able to add get ignored and some license falls for now. We don't need any off them. Let's just click create a repository Now we ended up on another page, which is already similar to the page, which we described recently. I made the top part off this page. Also here we have some instructions for creating a new report or adding an existing one. And regarding this instructions, let's talk about in the nice. Like you 16. Push Local Repository to GitHub: Okay, so we created our very first repository in the previous lecture. But for now, as you can see, we don't have here any files or folders because we should add them from the local repository. Here we see some instructions. Also on top of them, we have a link off are repulsive. So the first part off these instructions shows us all the steps starting from the get initializing three pushing local repository to get help. Most of those commands your although the family with I mean those three commands give in it , get at and get commit. We have been using them in previous lectures. The first command here shows us how to create the read me file with some comments. For now, let's don't pay much attention to it. As for the last two commence, there used to connect the local repository to get up and then to push the report to give him So this instructions are supposed to be used when you don't have your local repository yet. But in our case, we have already created. So we need to use the second part of this instructions. I mean, those to commence. So let's go back to your working environment where we have our local repository. Let's check the history of our commits wrong gets log, dash, Dash one line. So overall we have to come. It's inside off Origin Files folder. There is just one untracked files about dot html. I'm going to add it to the staging area and then make a new commit Let's run gets at. Then we need to specify the folder name Arjuna Files slash and found them about that HTML that check the status and now make new commit with a message added about dot html five. And finally check the history Ron gets. Look, dash, dash one line. All right, so now we have three commits and it's time to push our local repository to get her. The first step that you have to go through is to connect our local report to give him and for that we have to run the following command when it gets remote and next we need to set the name off the remote. It is actually optional, but commonly it is called origin. So I'm not going to change it. And after that we have to specify the link off our repository, which actually was generated by give him in general, get hub Gives us two types of links. The 1st 1 starts with https. As for the 2nd 1 it sells with as as H. In this case, we're going to use https. So let's copy dealing from here and paste it in our terminal. So once we run this command them, our local repository will be connected to get up, and the next step is to push it to give him for that. We need to round the following comment, get push than the name of the remote origin. And finally, we have to indicate here the name off the branch for now we don't know much about Branch is the only thing that we know is that currently we're working on the default master branch. So that's indicated here, as they say, we got here a little pop up which requires us to enter our get up credentials. Sella's quickly enter our user name and passport, and after that we just need to reload the page. All right, so here we have our reports story with all the files and folders which we had locally. Okay, so we have successfully pushed our local repository to give up. Next, I'm going to show you how to add commits from get up and how to pull data from get up to the local repository, so that's more. 17. Make Commit on Github and Pull Project on Local Repository: all right, so in the Progress Lecture will learn about how to connect the local repository to get up and also how to push it to get him. We pushed our existing local or post story. So here we have our files and folders at the top. Off those files will have a top commits and considered. Overall, we have three commits. If we click it, then we will see all three commits, which we have made so far. We see here the message of the commit, then on the right. Inside there is a proper I. D of committee, and also we see the author off the committee and the time when the committee was made. In our case, the author off committees trying get it is a different from the name off the user, which we used in the configuration. If you remember, we used some dummy name and the email, and that's why I get help, didn't recognize them by developing said this name as the altar off commits. So it's changing configuration the name and the email and used a valid ones. At first, let's check our current name and the email for that. We have to run git config, Dash, Dash Global, then use a dot name. So the name is said is John. Let's check the email as the email we have john at gmail dot com. All right, let's go ahead and change both of them. I'm going to set name as code and create Web. As for the email, let's setting US code and create Web at gmail dot com. So now, once we change the name and the email, it doesn't mean that the author, off previous commits will be changed accordingly. If we reload the page that still we will have the previous name, let's see what happens if we add a new commit, I'm going to interfere h one heading element with the tax Hi there. Then let's add this file to the staging area. And now I'm going to make a new commit with the commit message commute from New. Often after that, we should push our local repository to give help. And for that, as remember, we have to run the following command get push origin, which is the name of the remote, and then master, which is a name off the branch. Now if we reload the page, then who will get a new commit with a new author? All right, now it's time to make and you commit. But now, from get up, I'm going to show you how to added files and how to create a new commit let's open index dot html file. So, in order to added the style, we should creek here this icon, and after that we will be able to make some changes in the next that HTML file. I'm going to add here a paragraph. Unfortunately, we don't have any help from the enter. We should time everything manually. So once we added this, file them down below. We should make a commit the first impossibilities for the message of the commit. Let's answer to your added paragraph. As for the second you put field, it is for extended description, and actually it is optional. Anyway, let's institute something. Let's say we updated index dot html file from kita, and now we should click commit changes. So now we have created a new committee from get up successfully. As you see, there is a new commit with commit message at it paragraph. Also, if we click those three dots here than the description will be displayed. Okay, so we created new Commit from Geeta. But let's see what happens on the local er post story. If we try the history using gets, look dash, dash one line, then we will get only the old commits. It means that our local repository is out stated, and it doesn't recognize the newly created commit from get up. So now it's time to pull the data from geek, um, to the lock of repository. And for that, let's move on to the next lecture. 18. Pulling from GitHub to Local Repo: Okay, so we made our very first commit on get Hub. But as remember from the province lecture when we checked the history of our local approach story, newly created commit didn't end up there. So our local repose story is outdated and we have to pull the data from get up to it. In order to do that, we have to run the following command, get full origin and then master. Now, if we check again the history, then we'll get you the last commit from Kita. So once you make the commitment, get help. Then in order to update your local repository, you should use the gate full command. All right. When you work with get and get home, you should be frequently using git pool command with specifying the name off the remote. I'm in origin and the name off the Branch Master in order to avoid indicating those names all the time. Get closest to set kind of shoulder way to pull data from the remote re poster. So for that, we have to run the command. Get branch dash dash, set fish upstream Invest too equal origin slash Master And then again, master. So the first master is a branch on our repository on kita up. I mean this branch right here, which is created by default once we create the repository on Geeta. As for the second master, it is a default branch on the local repository. So once we run this command and then make a new committee on get up. By the way, I'm going to show you how to create a new folder or file on Gator. You have to click create new file. Then if you need a new folder, you should said its name, followed by the forward slash and now we have to indicate the name of the file. Let's a scream. Doj Yes, After that, let's make commit added JavaScript file. Now, in order to pull that newly created commit to local repository, we have to use again get pull, commend. But now, without indicating any of the names like origin or master, we just need get pool. And if we check the history, then we will find here newly created, commit added Js file. All right, sound that sit in this lecture, we have learned about how to pull the data from get up to the local repository and also I showed you how to do that in kind of shorter. Wait 19. What is Branch: hello and welcome to our new section in which we're going to be talking about one off. The important features of gate which is branching and get branches are a part of our everyday developing process. For example, when you want to add a new feature to your project, or maybe you might need to fix a but then you can use branch. First of all, let's recall what branch itself is. As you can see on the diagram, there is a project timeline we have here different commits, and this timeline is actually a brunch by default. When you create a report story and then make different commits, you're working on the master brunch, which actually you have already seen lots of times in the previous sections. Sometimes you may need to add a new feature to your project, and at the same time you don't want to touch or break the current state of the project. In that case, the best solution is to create a new branch and work all the newly created brunch. I mean to add files, make commits and so on. Then, after creating and testing the new feature, if you're happy with that then you can merge this bride to the master brunch. You're able to create as many branches as you wish. Also, it's really helpful when, for example, several developers are working on the same project. Each of them can work on a different branch without breaking other developers work. All right, let's go ahead and see in practice how to work with branches again. For now, we're on the master branch. So in order to create a new branch, we need to run the following command, get branch, and now we have to specify the name off the branch and this guy's let's say feature one now , in order to check which branch we're working on, and also what branches do we have? We can run. Get branch now, As you see overall, we have two branches master and feature one, and currently we're on the master brunch. It has different color, and also in front of it there is placed an asterisk. Let's see how we can switch to a different branch. For that we have to use get check out, and then we have to specify the name off the branch. This guy's feature one as a seat Now we switch to branch feature one and it will run again . Gauge Branch. You will see that now we're working on a future. One branch also the name of the brunt inside of the parentheses is different Now. If we checked the commute history using get locked dash, dash one line, we will get all the commits which we have made so far. So we're able to use those commits and also make new ones which won't be available on the master branch In order to prove that I'm going to make some changes to the project and make a new commit that's open style dot CSS file and change the color of heading element. Let's make it green then at this file to the staging area, using kids at and finally make a new commit but the message styled heading. So now if we check the history, then we will get here than you commit Styled heading. But actually, if we switch to the master branch using get check out master, then you will see that the style for the handing of it has gone from the CSS file. And also, if we check the history, then the last commit won't be available here. All right, let's move on and see how we can create and switch to the newly created branch with just one comment. Suppose that we want to create another branch, featured two and switch to it immediately. We need to run, get check out. Then we have to use flag dash B and we have to specify the name off the branch future too. So know who run gets branch. You will find that overall, we have three different branches and currently we're on the newly created feature to branch . All right, Before we finish this lecture, I'm going to show you how to delete branches. For that we have to run, get branch and the flag tache d But we need to write it in upper case. And then we have to specify the name off the branch. Remember that you cannot Billy the branch which you're currently working on in this case we're on figure to. So if we try to delete it, then we will get an error saying that we cannot delete branch future too. But it would change feature to into, for example, feature one then it should be deleted. If we run, get brunch. Does that feature? One branch will be no longer available. All right, so that's it for now. In this lecture, we have learned about how to create a new branch, how to switch between different branches and also how to delete them. See you in the next lecture. 20. Branching on GitHub: All right. So in the last lecture will learn about branches and get we created new branches. And also we saw how to deliver them. Let's check what branches do we have here? For that? We have to run gauge branch. So no. Overall, we have two branches master and feature to and we're working on the future to brunch. All right, let's check the history of commits on the feature to branch. Ron gets log, dash, dash one line. So here we have all the commits which we have made so far on the master brunch. I'm going to add new commit on future to let's add some style to the handing elements selected and change its color. Then add style dot CSS fell to the staging area, then make Mucha meat with message styled heading and finally check the history Run again gets locked. Dash dash. Well, not all right. So here we have our last commit and also here we see that it belongs to feature to branch, which is one commit a had off the master branch. Ok, now I'm going to show you how we can add a future to branch to our get hub recalled story. It is very simple. We just need to run, get push that origin, which should be followed by the name of the branch feature to now if we check our get hub repository. The first thing that we may know this year is our recently pushed branches in this guy's feature to and also we see green button on the right hand side. Compare and pull requests actually regarding pull requests, we will talk a bit later. So now who reload the page and drop down this button? Here we will find branch feature to Let's go I haven't selected. Then go to commit Stop And you see here we have last commit which we made on the feature to branch. All right now I'm going to show you how we can create branches from get hub and then we will add these branches to our local repository. So in order to create a new branch, we need to drop down this Batam it to see he will have an input field and we have to enter the name of the new branch inside off the input field. That's eight feature one, Then we have to click create branch. So, as you see, we have created a new branch from get help successful. If we checked tab branches will find all three branches. Master feature one and figure two as the seam master is a default branch and also on the right hand side off the feature one and feature two branches. We have some numbers. If we hover over it, it will show us that feature two branches. One commit a hat off, Master. That's because we added a new commit on feature to branch and that commit doesn't exist on master brunch. Okay, Now let's see how we can add branch from get up to the local repository for that. First of all, we have to run command git pool origin feature one and then we need get check out dash dash track than origin slash on the name off the branch feature one. So now we added feature want to the local repository and also we switch to it in order to check that Let's run kids branch. So overall we have three branches, master feature one and feature to and currently we're working on feature one I'm going to add new committee on get up to future one branch that's open script Js file and create a variable Then make commit with the text created variable. So now, in order to add this, commit to the local repository we should run Get pull Origen and the name of the branch feature one Now if we check the script Js file, you will find the newly created variable and also if we check the history of commits using get locked dash, dash one line Then we will find here over last commit So each time when you make a new commit on get up on feature one branch Then to add it to the local repository, you just need to run get pull origin Feature one comment All right, let's see how we can delete the branch from D Tub And also I'm going to show you how we can delete the remote branch from the terminal. So, in order to delete the branch and get help, we have to go to the tab branches. Then we just need to click that deal it I could So as you see, we no longer have here Branch featured one. We can do the same locally. Let's delete branch feature to for that we need to run, gets push origin that dash, dash, delete. And then we have to specify the name off the branch featured two. So once we run this command, then branch on get hub won't be available. All right, so we deleted branches on get her. But they still exist in the local repository, so I'm going to delete them from here. It's Well, first of all, let's switch to Master Branch. Ron gets check out, master, then delete branch feature one for that, we need get Branch Dash D and the name off the branch feature one Let's do the same for feature to as well and finally run. Get brunch. As you see we have here just the massive brunch. All right, that's it for now about branching on get hub. We have to consider some other topics regarding branches. And for that let's move on to the next lecture 21. Git Merge Part 1: in the last section will learn about how to create different branches in the local repository. And also I showed you how to do the same on get help in a real world when you create different branches and work on them, Eventually unit to combine them with the master branch, and this process is called Merging Branch. So in this section we're going to look at how to merge branches, what type of merges do we have? And also how to result some conflicts that might a cure during merging the branches. All right, let's go to a working environment and start working on merging branches. First of all, let's check what branches do we have for now? Iran get brunch. So currently we have just one branch, which is master also. Let's love the history. So we have here a couple of commits from previous lectures. I'm going to create a new branch that's called it death, which stands for develop, and also I'm going to add a couple of commits to the new branch for that. First of all, we need to switch to that brunch. Let's rank it check out Dev, then open style dot CSS file and change caller for heading Let's make it blue. Now I'm going to add this file to the staging area and then make commit, as we have other early down, lots of times. Previously, we used two different commands skeet at and get commit. But we can use shorter way with just one command. We can run, get commit Dash A M and then we have to specify the message. Let's say Styled heading. So now we added the file to the staging area and made a commit simultaneously. So this is a shorter way. But you have to remember that this comment works on before modified and deleted files. But if you have new files which are no tracked, this command won't work and have to use previous commands. I mean, get at and get committed separately. All right, let's add one more commit. I'm going to add style to the paragraph. Let's change. It's called Arrest Ball and then again at the file to the staging area and make commit Ron get commit Dash am with the message styled pervert. Let's look history. So as you see, we have lost to commit year and Death Branch is to commits a hat off the master branch. So now suppose that we're happy with those changes and we want to merge those two branches to do that. First of all, we have to switch to Master Branch using gate check out. So at a glance, you can notice that styles for heading in paragraph are no longer available. And also who you run history, who will get all commits, which were made on the master branch. So far. So now we have to merge those two branches and for that we have to run, command gets merge and we have to specify the name off the branch death. So once we run this command than the styles will be displayed and both branches will be merged. If we're around the history, you will see that now had points to both branches, master. And so we have combined to different branches successfully. And this type of merge is kind of basic one, and it is called fast forward merch. So in the case off fast forward merge. There is a linear path from the master branch to the second branch, which in our case, is that brunch. So this branches created based on the last commit off the master branch. It means that while we were working on death brunch, there wasn't added any new commits on massive brunch. And once we merge, those two branches then simply commits from Deaf Branch were added after this base committed to the master brunch. So any changes which were made on Death Branch should be applied, and they will overwrite Old State off the master branch. And there won't be any conflicts to prove that. Let's switch back to that brunch, then change colors off, heading in paragraph and make new commit around. Get commit Desh am with the message updated starts, then go back to the master Branch and march both branches. Ron gets March death, so as it seeing now, new colors are applied to heading in paragraph, and the old stars are over written without any conflict. All right, so that's the way how we can merge two branches in a fast forward way. There is another type of merge, and regarding that, let's talk. In the last election 22. Git Merge Part 2: all right. So in the last lecture we learned about how to merge two branches and we considered fast forward type of march. Now I'm going to show you another type of merge, which is called Three Way Merger. This kind of merge a cures when we create a new branch, work on the branch and at the same time someone else makes commits on the master branch before we emerge the branches. Let's consider this type of merge with an example. Let's recall what branches do we have. I'm going to run, get branch! So overall we have two branches, master and death, and currently we're on the master branch. Next, I'm going to log the history. So as the sea had points to both branches because the last thing that we did Waas merging off those branches. Now I'm going to switch to the branch. What's wrong? Get check out death and then let's make a couple of commits open script Js file and create a variable. Then make a new commit I'm going to use again get commit Desh am, which allows us to add file to the staging area and make the commit simultaneously as the message that's interfered, created variable, then love the history. Next, I'm going to make another commit. Let's create a function in Charles could file and then make a committee use again. Get committed. Tash am with a message created function and finally, let's around the history. All right, so now we made to commits and death branches to commit ahead off the massive brunch. Now suppose that someone else is working on the master branches well and is making some commits to imitate this process, I'm going to switch back to the massive branch that I'm going to make some changes in index dot html file. Let's create a span element where the content this is span out, then make a commit run again. Get commit. Yes, I am with message addict span element. And lastly, let's love the history. Now suppose that we want to merge those two branches. In this case, we will no longer have a fast forward merge because we've been working on both branches simultaneously. Let's go ahead and merge those two branches. Ron gets merge death. As you see, the new file is opened in our text editor, and also we got the hint in the terminal, saying that get is waiting to close this file in attitude so we don't have to do anything in this file. Let's live it as it is and just closed. So Murch is made successfully, but in this guise would have a different type of march, which is called Three Way Merche. Also as a C here. It was made by the recourse of strategy, which actually is the default strategy off three way merger. Let's love your history. So, as you see we have here new commit with the text merch, branch death. So now all the changes which we made on Death Branch are available on the master branches. But unlike the fast forward approach had points to master and not to both branches. The reason is that after making commits on the depth branch, we made a commit on the master branches ball, and that's why we see here just master next to head pointer and not both branches. If we switch to duck brunch, then this panel meant won't be available. And also, if we check the history, we will find on Lee the commits which were made on that branch. All right, Let's take a look at the diagram and see once again went three way merger cures. So when we create a new branch, Makesem commits on the branch and then someone else makes commit on the massive branch. It means that we no longer have fast forward merge and merge type is three way merger. So in this guy's get will check out if there are any conflicts in files, because people may work on the same files. If everything is OK, then that branch will merge to master and the commits will be placed in a sequence in history. So that's the case when three way merger cures all right. In some cases, there might be emerging conflicts. You have heard these terms several times and to learn what it means. Let's move on to the next lecture. 23. Merge Conflicts: so in the previous lectures will learned about how to merge two different branches in fast forward and three way merger ways. Sometimes multiple developers may try to added the same content. For example, if one developer tries to added coat, that the second developer is editing than the conflict may acute. So in this lecture, we're going to talk about merge conflicts. Actually merging and conflicts are a common part off. Get in other version control systems. It is slightly hard to deal with Merche conflicts, but get makes it relatively is all right that same practice when merge, conflict secure and how to deal with them. First of all, let's see what branches do we have around? Get branch. So for now we have two branches that and master and currently were working on the doubt brunch. Suppose that we want to make some change in script The Jays file from Death Branch. Let's change the value off variable a, make it 50 and then make a new commit around kid commit with Aflac, Dash am and with message changed the value off the variable A. That's loved history. So here we have a new committee, which is made on the death brunch. Now suppose that someone else is editing script Js file and is working on the same line but from the massive brunch. So to imitate this process, I'm going to switch to the master branch, okay? And I'm going to change the name off the variable. Let's make it see Then let's make new commit Iran gets commit Desh am with a message, changed the name off the variable and finally, let's around the history. So, as you see, we have here the last commit made on the massive brunch. Now suppose that we need to merge those two branches for that as you. All of you know, we have to run, get merge and we have to specify the name of the branch in this case death. So once we run this comment, then get will say that we have a merge conflict in script RJ's file and we will get here some different texts inside off the file. So because of that, we have been working on the same line from different branches, then get wasn't able to decide which version off the code to keep therefore the conflict as arising. So now we displaced both versions off the code and we just need to choose which one is appropriate for us. In order to solve this conflict, we just need to added this code manually. First of all, I'm going to delete those lines which are added by get. And then I had to decide which version of the code I want to keep. Suppose that we need to change the name on the value as well. After that, we have to save the file and added to the staging area. So once we added to the staging area, then we have to make a new commit. But in this case, we just have to run, get commit without any message. So once we run this command, then the new file will be open in any text editor as it was in case off a three way merger . Here we can change the message of the committee, but let's leave it as it is. So once we close this file, then new commit will be made, branches will be merged and conflict will be solved. If we around the history, then you will see the Alaska meet merge branch depth. So it means that we have merged branches successful. All right, so that's the case when merge conflicts, a cure. And also that's the way how you can fix them. Now I'm going to show you how to stop more Jim conflict for. Then again, let's added the same line of code from different branches. Currently, we're on the master branch and let's go ahead and change the name off the function. Let's make it my funk. Then make a new commit run. Get commit. Desh am with the message changed the name multi function. Next, I'm going to switch to death brunch. And now let's insert your inside of the function the block of Code Castle, that log Hi there. Then again, make and you commit git commits Dash am with a message added a block of coat. All right, so now it's time to merge branches for that. Let's go back to the massive branch and then one gets merge death. So again, we've got here merge conflict because we worked on the same line of code and now if we want to stop merging, we can run, gets merge dash, dash abort so this common will stop merging. Also we will no longer have here conflict, but it keeps all the changes which we have made on both branches as a city name off. The function has changed, and also if we switch back to that branch, then the function will have a block of coat. So remember that gets merged. Dash dash abort just tops merging. And it keeps all the changes that are made on the same line of code from different branches . All right, before we finish this lecture, let's merge again branches and also solve the conflict. Let's go back to the massive branch. Then Ron gets merged death. So I'm going to live here. The second version of the code. Let's delete all the lines of code, which we don't need. Then at the file to the staging area. Next minute to run, get, commit. And finally, let's check the history. So as you see, everything works fine, all right, that's it about March conflicts in real world. Such conflicts may a cure frequently, but thanks to get is quite simple to deal with them. But anyway, when the developer team is working on a project than each member off, the team should know what is he's or her working area and which falls to work on in order to avoid such murder conflicts. Okay, let's move on to the next election. 24. Git Rebase: all right. Once we're family with merging branches and also solving merch conflicts, now it's time to discuss another feature off kids, which is called Gates Rebased. Get repast is one of the tools which is used to integrate changes from one branch into another. In other words, re basing in the process of moving or combining a sequence off commits to a new base, commit in order to make this words more understandable. Let's take a look at this diagram. Suppose that we have a couple of commits on the master branch. Then we create a new branch and add to its a mother commits. And then after that, we create a new commit all the massive brunch. So in this case, by default based commit is the committee from where we created a new branch. But using get re pace, we're able to change the base, commit and re base our branch on the newly created commit all the master branch. Also, the changes which we made on the massive branch will be available on the second branch is Well, all right, let's go ahead and see in practice where we're talking about. First of all, I'm going to make some changes in our local repository. We have already made lots of commits, and I think it might be slightly confusing. So I'm going to delete most of them. Let's just live here for us. Five commits. I'm going to copy this I d. Then in order to deal, it commits, we have to run, gets reset Dash, dash, heart and pace you I d. So who run? Get locked? Dashed Rashwan Online. We will get here just the 1st 5 commits. And besides that, I'm going to delete Death Branch at all and created brand new one. So that's Iran. Get Branch Tache D and the name off the branch death. So now they branches deleted, and we have to create a new one for that. We need to run, get branch. Let's call these branch future. Then I'm going to switch to it and finally check the history so everything works. Fine had points to both branches. I mean master and feature, and it means that they have the identical histories. So now I'm going to switch back to the massive branch and make a new commit. That's changed the phone size for the heading element Let's make it 30 picks us and then make a new commit well with the message. Changed phone size for each one. Then run the history So the new committee is created. And now the master branch is one coming to head off the future brunch. So it means that this change is not available on the future branch. If we switch to it and check the history, then you will find that he would don't have the last committee made on the massive brunch. So now if we want to make the Alaska meat from the massive branch available on the future branches, well, we can use get re pace, which will hello us to re base the future branch on the newly created commit, which was made on the message brunch. So let's run kits re pace Master that lovely history. So now is the sea had points to both branches feature and master and means that now the last coming from the Master branch is available on the future branches. But all right, let's concede there again with different example. How get rebates burgs. I'm going to add a couple of commits on the future branch. Let's change the phone size for paragraph, then make a committee with a message changed phone size for Pete. Next, I'm going to add some margin to the body but Saturday's 15 pixels and again make the committee at it margin to the body and then run. He's to read. So we have here to new commits and the future branches to commit ahead off the master brunch. Now let's switch to Master and create one. Commit. I'm going to add a span element in index dot html. File with some content. This is a span element. And then make the committee with the message added, Spun and finally, let's love the history. So as you see, we have all the commits made on the master branch. But we don't have here the commits from the feature brunch. So the next thing that I'm going to do is to switch back to the future branch and re base it on the last commit, which we have just made on the massive brunch. So let's go to the future branch and then run get rebased, master. So now if we look the history you will find that feature branch is re based on the last commit made from the master branch. As you see, we have here. The committee added span and it is followed by two commits which we have made before this committee on the future brunch. So now all the commits are available on the future brunch. But if we go to the master branch and check the history, you will find that still, we have here the commits which were made on Lee on their master brunch. Now, in order to make, um, it's from the future branch available on the massive branches. Well, we can merge those branches so we can run, gets merch, feature. So, as you see now, the branches are merged and instead off three way emerge, we have here that fast forward merge. The reason is that we change the base, commit. I mean, we re based the future branch on the last commit off the master branch. And that's why it gets used here. The fast forward merch. All right. Ah, helping make sense to you. I know that it might be a little bit confusing, so I recommend you to test those things on your own rewatched the video or if you have some questions you can reach out and post them in Q A section and we will try to help. All right, see you in the next election. 25. Merge on GitHub: all right. So in the previous lectures we talked about how to merge branches, how to sell some merge conflicts using different ways. I mean, fast forward and three way merge. And also how to change the base committee using get three base. Until now, we have been working locally, and now it's time to go ahead and work on Geeta. In this lecture, I'm going to show you how to merge branches on Get up. First of all, let's recall, What do we have on our remote repository? So as you can see, we have a couple of commits made previously, and we have just one branch, which is a master. I'm going to go ahead and create a new branch. As you remember. We just need to drop down this button here, then type name off the branch inside of the input field. Let's call it feature one, and then we have to click create brunch. So, as you see, we have now to branches. If we drop down again, this button will find two different branches, master and feature one. All right, so now the next thing that I'm going to do is to make some commits on that newly created branch. Suppose that we want to add some stars to heading and paragraph. I'm going to open the style dot CSS file. Then two added, This file would have to click this little I can hear, and after that we will be able to add in the file that's select h one heading elements and change its color. Make it, let's say Green. Once we added this file, we have to make a new committee. Let's insert here The commit message changed the color off h one and finally click commit changes. All right, so we have made any commit to the feature one branch successfully, as you see on the master branch. Overall, we have six commits. But if we switch to the future, one branch you will find seven commits. It means that the future one branches one. Commit ahead off the master brunch. I'm going to add one more commit. Let's add it once again, the style that CSS file and now change the color off the paragraph. Let's make it blue, Then don't blow. Make a new commit with a message changed the color off. Pete. All right, so currently the future on branches to commits ahead of the master branch. Suppose that we're happy with the changes, and now we want to merge the future. One branch to the Master brunch, As you can see here is displayed a green bottom called Compare and Pull requests. I'm going to click this button now. We ended up on a new pitch. Let's go ahead and describe What do we have here? So to merge branches on Get Hub, we need to create a pull request. That's why we see here heading, saying open April request. And underneath it, we can read Create a new pull request by comparing changes across two branches. So before we merge the branches, when you compare the changes between two branches and create a pool request here we see two branches master and feature one the branches, which should be compared next to them. There is a green check mark, followed by the text able to merge. These branches can be automatically merged. It means that we don't have an emerging conflict, and the branches are afraid to march. Next, we have some input fields in which you can leave some commons. Let's interfere updated style that CSS file. Let's leave the second input field empty down below. There are displayed the commits which we made on the future One branch. And at the end of the page you can find the changes that we made to the start. Artsy is a spot. Those plus signs indicate the code that we added recently inside of the CSS file. All right, so everything is ready to create a pull request to the that. We just need to click these green bottom few. Okay, so we have created the pull request we see here the user name who wants to merge two commits into master from feature one branch also down below. We see this branch has no conflicts with the base branch. The base branch is the same as the master brunch so we can merge the branches. Let's collect the bottom merch, pull request and then click to confirm the merchant. All right. So as you can see it, the pull request is successful. Emerged and closed and now weaken dilate the branch. You're all set. The future. One branch can be safely deleted. Let's click this button here. So we have successful emergency changes from the feature one branch to the massive brunch. If we check the commits, history will find three new commits. The 1st 2 commits described the changes made in the style of CSS file. As for the last commit, it's saying that we merged the pull request from the future. One brunch. Okay, so that's the way how we can merge branches on Get Hub. In this case, we have been working on the remote repository from just one account in the real world. When you want to contribute to someone else's repository, then you might not have the permission to merge. The Branches unit is sending people request to the owner off the report, who will check the changes and then merge the brunches. We will discuss all those things a bit later. But before that, let's see how to deal with Merche conflicts on Get up in the next lecture 26. Merge Conflicts on GitHub: in the last lecture will learn about how to create a pull request and merged two different branches on Get Up, as it wasn't the case off the local repository. Sometimes you might have merged conflicts on the remote repository as well. So in this lecture, I'm going to set up some scenario in which you might get the March conflict and I will show you how to deal with it. So currently we have just one branch and argued have proposed to re with a couple of commits, Let's go ahead and create a new branch. I'm going to call it test So the new branches created. And now let's go ahead and make some commits on that newly created branch. Suppose that we want to add some code inside off the script or Js file. Let's open it, then click the addict I can and create variable. I sat itude. Some number value that's 100. Then down below, make a new commit created variable. After that, I'm going to make another commit Let's at some were code to the script or Js file, create another variable and assigned to some plain function. But then again make the commit with a message created function. All right, so we made two new commits on the test branch, and now it is, too commits ahead off the master branch. Now suppose that we or someone else is going to make a new committee on the master branch, and it's trying to added the same line of code, which we have been working on on the task branch. Let's see what will happen. I'm going to switch to the master branch. Then let's open script RJ's file and create a new variable with some string value. Let's say hi there and then make a new committee created variable on master. All right, so all the changes are made. And now suppose that we need to merge those two branches. First of all, we need to create a pool of request for that. Let's go ahead and click the button, compare and pull requests. Once we do that, then we will go to the page, which you're all of the family or with at a glance, you might notice that instead off the green check mark and the tax able to merge, we have here Red X sign and the text can automatically merch. So we're facing the merch conflict. The reason is that we tried to added the same line of code from the different branches. Right after this warning taxed, we can read, Don't worry, you can still create the pull request. So despite Emerge conflict, we still can't create April request. Let's face it here, some comment. That's a updated script. OJ's file. Then click the button. So now we got here another warning saying that these branch has conflicts that must be result. Right next to this text, there is a bottom called Result Conflict. Let's go ahead and click this bottom. Now, as you can see, we've got here some tax actor in which we should resolve the conflict we have here both versions of the code on. We need to choose which one to keep get help itself, cannot decide it needs our help, and this is the exact same situation which we So while we've been working on a local repository, now we need to resolve the conflict manually. Suppose that we want to keep variable B instead off variable A. So let's deal it all this stuff and just keep the variable B and the function. After that, let's click Mark as a result. So the conflict is resolved and we can proceed. That's click commit, merge, then click merch, pull request and finally confirmed the merchant. All right. So again the conflict is resolved. Pull request is merged and closed. Now we can feel free and delete the test brunch. If we check the commits, history will find here a couple of new commits which were made automatically in the process off emerging. Okay, so that's the way how we can resolve emerge conflicts on get hub. Now we have to move on and learn about how to copy the remote report story on a work it have account how to chrome it to our local computer and how to contribute to someone. Alice's report Celts see in the next video 27. Fork and Clone: all right, so in the last lectures will learn about how to create pull requests, how to merge branches on get up and also how to deal with emerge conflict. Now, as I promised, I'm going to show you how to copy someone else's repository on our get up account and how to clone it to our local computer. So in this lecture we will be looking at forking and cloning on ghetto. Those two options alot us to get access to any off the open source repositories which are available on get up work on them, make some changes in updates and contribute those updates to the original project. To proceed with the lecture, we will need to use the second account. I have already created a brand new one. As you see, we don't have here any repositories. I'm going to search for the repository which we have been working on so far, and then we will copy it to the newly created account. So, first of all, to work with me along the way, let's go ahead and create a brand new account, or you can feel free and use any other accounts. If you have one Of course, once you have access to a different account, then go ahead and search for our working repository. In general, we can search for and use any off the open source repositories which are available on Get Him. But for now, I'm going to use our repository in order to make things a bit more easy. I'm going to search for the user name of our previous account because if we search for the name off the report which is get project, we will get tones of results with the same name. So let's search for the user name. In my case, it's code and create web. But of course, in your case it should be your user name. Then click here down below the users. So here is our user name and the repository as well. All right, now we have to copy the repository to our current account. To do that, we have to click the button called Fork, which is placed at the top right side of the page once we click it. Then after a few seconds, the entire report story we copied to our new account. So here it is. Now we have the exact same copy off the original Repo. All the source files air here. Also, if we go to the commit stop, we'll find all commits, which have been made so far. So using the fork option, get help Pelosis to copy the original repository to our account. If we check out the original report story, then right after the fourth button will find the number of folks. In this case, it's one. If we click it, then we'll find the owner off the original report and the user name who forked the report. All right, so that's it about four King. Now I'm going to show you how to clone the repository to our local machine for support. Let's go to the terminal and create a new folder on desktop. Currently, we are in our working folder, so let's go up one directory for that. We need to run CD double dots that I'm going to create a new folder for that. As you remember, we had to use the command and K d I. R. And we have to specify the name off the folder. That's a get project clone. So once the folder is created, let's enter it Now let's go back to a work eat up account. So to clone the repository, we have to click this green bottom Here, it's called Clone or download wants me. Click it, then dealing should be displayed. Let's go ahead and copied this link. Then go back to the terminal and round the following command. Get clothes. And now we have to paste here the link which we have, just call it. All right, So the repository is quant. Let's run l s, which shows us the files and folders which the current directory consists up. As you see, there is added a new folder called Get Project. If we answer this folder, then we'll find a copy off the original repository. We have here all the source files and also if we around the history using get locked, dash, dash more online, then we will get all the commits that were made on the original repository. All right, so that's the way how we can make a copy off the remote repository to the gate, have account using a fork and also how to clone the report to your local computer using git Clone. Next, I'm going to show you how to contribute to the open source repository. And for that let's move on to the next lecture 28. Contributing: all right. So in the last lecture, we talked about how to copy the remote repository tore account using a fork, and also we so how to clone it to our local computer. Now it's empty. Move on and consider how we can update the repository and then contribute to the original one. Nowadays, there are tons of open source projects on get hub, which different developers are working on. They copied this report stories update then and then sample requests to the owners to apply those changes in a place to the original project. On the other hand, the owners of the project received pull requests from developers. Consider the changes and if they are happy than they emerge, updates to the original repository. This process is called contributing, and that's the way how different libraries and frameworks are updating today. All right, so in this lecture we're going to go through this entire process currently and working on the repository which we cloned in the last lecture. It's the exact copy off the original project which we have bean working so far. So now I'm going to make some changes to this project here. I have opened the clone project in Venus code. Let's go to the index dot html fell and create some new Ellen's. Let's say four moment and inside of it, I'm going to insert input and button with a text click you. Then let's go ahead and add these change to the staging area and make a new commit for that I'm going to use again the shorter way we have to run command git commit Dash AM with a message created for around Let's around the history. So we have here a new committee. Let's go ahead and add one more commit. I'm going to add some stars to the newly created four moment Let's open style that sees a smile and he secure some styles. Let's define margin and parting for four months and then again make and you commit with a message style. Four months. All right, so that's it. We have updated the project and suppose that we want to contribute these changes to the original report start. So what should we do? First of all, we need to push these changes to our second get help account. I'm in the account where we forked the repository for that. We have to run. Get push Origin, Master, as they say, We've got here some error. Actually, that's the issue. Off. Get and get help credentials, which we have already set up previously. We need a permission to push the changes to the remote repository. To do that, we have to change the credentials from the control panel. So let's go ahead and open it that we have to go to user accounts, select manage windows credentials. Click here, get and get up. And then click addict. So now I'm going to change the user name on the passport. You have to use your user name and passport off the second account. So once we do that, then we'll be able to push the changes to the remote repository. So let's run once again gives push origin Master. Now, if we check our get have account and reload the page, then we will find here the last two commits, which we have just made. All right, fine. So now we can send those changes to the owner off the original repository. For that, we have to create a new pool request. We need to click this button here now, as you see get hubby's comparing to changes between two branches. In this case, those two branches are the massive branch off the original repository and the master branch off our second report. In our case there no conflicts and branches can be automatically Merced so we can feel free and create April request. Let's click this green button here. Now get help is asking for to make some comments and descriptions. In the real world, when you try to contribute to some projects, you have to send some descriptive comments to make an easier and clearly emerging process for the owners off the project. So let's put you some comments right, updated project and then down below. I'm going to ease it. Some descriptive text, Let's say, added a new form element in index of html file and styled it from the style. Don't CSS thought so. Now we are ready to create a pool request. Let's collect this green bottom, Hugh. Okay, so the pull request is created, as you might notice, were not allowed to merge the branches from here because it's the job off the owner off the project. Now let's go ahead and switch to the owner's account. I mean the accounts which owns the original project. If we reload the page, then we'll get Year One full request. Let's click it so you can find here the pull request, which we have just made from the second account. With all its comments and changes, we can review the commits made by the another user. Also weaken review all the changes which were made to the project. As you see, there are two fouls changed in mix of HD Melons 1000 CSS. The code in green collar with plus size is the updated version off the file in both cases. So after checking the changes, if we are happy with them, we can merge the branches. Actually, you can right back to the user some text, Let's say great job, and then you can merge the branches so the original project is updated. If we check the commit stop, we will find all the commits made by another user, followed by the committee about merging their branches. All right, so that's the way how we can contribute to some open source repository on. Get up Now I'm going to show you what happens if there is a merging conflict. Let's make some change from the second user. I'm going to do that straight from get up. Let's increase the size off the margin and make it 30 pieces also make a new committee increased margin. Then suppose that before we make, they pull repressed. In the meantime, the owner of the project changed the sides off the margin as well. To imitate this process, let's switch back to the owner's account and change the size of the margin. Let's make it 25 pieces and stand mate, and you commit changed margin. After that, let's create a pull request from the second account. Click the button here. So as you see, we have a conflict because both users were trying to added the same line of the coat. So what can we do to you? Firstly, we can create the pull request anyway, despite the conflict. Next, we can either result the conflict from here or we can leave it as it is and let the owner to do that. The owner off the project will get the pull request with conflict anyway, so if we switch back to the owner's account and check the pull request up. We will find their request with the conflict. Now we can resolve the conflict from here, as it was in the previous case. Suppose that we prefer to increase the margin to 30 pixels, So let's make here the appropriate changes. Then mark as result. Commit march. Now get Hub won't sells about emerging, click this button and finally merge pull request. If we checked, it commits history. Then we'll find all the commits made on both accounts, including the Merge commits. All right, some that said about contributing to the original open source repository. I hope it makes sense to you. Let's move on to the next election. 29. Add a Collaborator to the project: hello and welcome to our new section, in which we're going to be talking about one of the most important topics regarding get help. And it is collaboration. In the previous section, we discussed how we can copy the remote repository to work it have account than how to clone it to our local computer, make some changes in updates and eventually contribute to the original project. This process is something like collaboration, but in fact it's not. In the case of collaboration, the owner off the project can add different developers as collaborators, which then will have almost identical rights to manage the project and saying almost because there might be some rules which should be protected by the collaborators. All right, that same practice, how to collaborate on get up. First of all, I'm going to create a brand new local repository. I have created a brand new folder on the desktop called Get Collaboration, which then opens in fierce code and also with Terminal here. Let's go ahead and quickly initialize a git repository and then make a couple of commits. Let's run, get in it so the dot get father is created. It means that we have initialized get report. Next, I'm going to create two different files. Index dot html and style Nazi Assess. Let's add them to the staging area. Ron. Get at dot then check the status and make a commit run. Kids commit desh em with a message created index on HTML and styled with CSS files. That's around the history. So here is our first commit All right. Next, let's into the basic structure off the HTML document inside off the next elation in the file. Then make a commit. In this case, I'm going to use a shorter way. It's wrong. Get commits. Dash Am where the message added basic HTML instruction, then run again. Gets locked dash dash online. So we have here to commits. Let's make some more commits. I'm going to create an H one heading elements with a constant basis heading element. Then make a commit Ron get commit Desh am with a message added h one. And finally make one more commit That's open style that CSS files and create some reset styles. I'm going to set margin and putting for all the elements as zero don't make again, a committee with the message added reset stunts. And lastly, let's check the history around gets Look, dash, dash one line. So, as you can see over all we have for commits and we're good to go now, the next thing that I'm going to do it to create the remote repose story and push the local reports to read into it. Let's go ahead and go to our G public counts. Then I'm going to click the plus, Thank you and select a new report story. I'm going to call this re poll the same name, I mean, gets collaboration. Then click this green button here. We've got here some instructions, and now I'm going to copy doing from here. All right, let's go to the terminal and push the local repo to the remote repository for then we have to run, get remote and origin, and we have to paste your the link off the report. And finally we have to run, gets push origin must actually you might get you the error about the permissions. If so, then you have to change again the credentials from the control panel, as we did in the previous election. Okay, so if we go to the get a page and reload the page. We will find you are re poster. All right, so now we're ready to set up the team off collaborators. For that, I'm going to use again a different account. So in this case, I'm the owner off the project, and we have to add a collaborator to the project to them that we have to go to settings. Then on the left hand side, we have to select collaborators tub where it confined the input field in which we have to enter the user name off a collaborator. Let's type you code and create Web 123 As the CDU tub has found the user automatically, let's select it and then click the button. Add collaborators. So we added the user as a collaborator. But on the other hand, we need to get the response from the user. I mean, the collaborator should accept the invitation. If we check the gate of account off the user, then there won't be any notifications or invitations. So what should we do? We have to check the email. Let's go to the Gmail account of that user. As you can see, we've got here an email from the get up, saying that the owner off the project is inviting us as the collaborator for the project. We should click your view invitation and then we have to accept the invitation. Once we do that, then we will redirected to archetype account. And as you can see it now, the repository is available for us. Also, it would go back to the owner's account and reload the page. The user will be added as a collaborator. We are no longer waiting for the response. All right, so in this lecture we created a brand new report story and added a collaborator to the project Successful See you in the next one. 30. Working as a Collaborator: In the last lecture we created, the brand new repository pushed it to the gate of account, and also, we added successfully a collaborator to the project. Now the collaborator has access to the repository, and he or she can manipulate on the project. Let's go ahead and see how we can work on the repository as they collaborate, by the way to imitate the collaboration process and actually to work properly. I'm using a different computer. Otherwise we won't be able to work as a collaborator in the right way. If you have a different computer than you can use it for the second account. But if not, then you can just watch the videos. If you use just one computer, then you will get different results than us, so it might be slightly confusing. All right, so the first thing that you have to remember is that we don't need to fork the repository anymore. We just need to clone it to our local computer as the Order No. Two clones. The repository we have to click this green button here called Clone or download. It will generate the link off the repository. Let's copy it, then go to the terminal and create a new father. Currently, we're on the desktop. Let's create a new folder, call it, gets project, cool up, then go into this folder and finally clones the repository. We have to run, get clone and we have to pace year. Blink off the repository. All right, so we have successful week. Phone the project. Let's check the directory. As you see, we have here a folder called Get Collaboration. Let's go ahead and and so this fall it. So if we run the history off the commits using gets locked cash, stash more online, then we will get all four commits made by the owner off the repository. Also, if we open the folder envious code, we will find you in mix of HTML and style, etc. Is this falls with the proper content? All right, so now let's go ahead and make some changes to the project. Let's add some styles to the H one heading element. For that, I'm going to added the style that CSS file. Let's increase the phone size off H one heading element, then make a new committee with the message. Increased phone size off H one. Let's around the history. So the committee is added successfully. Let's make one more commit. I'm going to change the color off h one element. Let's make it glow over and then make again a new committee with the message changed Caller off H one. Finally, that's around the history. So we have you to new chametz made by the collaborative. All right, now it's time to push these changes from the local repository to get help for that, we have to run. Get push, Origen Master! So the command is run successfully. Let's go ahead and check to get help Accounts. As you can see, the changes air pushed fine and the repository is updated. According we didn't need a poll, a request or some permission from the owner of the project. We have pushed the changes to be get up without any problem. If we check the commit step will find two new chametz made by the collaborator. Also, if we checked the account off the collaborator, we will get the same situation. So in general, this kind of collaboration is not quite effective because the owner doesn't have any controlling mechanism and that might cause some unexpected results All right, let's stop here. And we want to the next lecture in which I will show you how to protect the branches and how to control the collaboration process. 31. Protecting Branches: all right. So in the last lecture, we pushed the changes from the local repository to get up as the collaborator. We did it without any problem. I mean, without any pull request or permission from the owner off the repository. As I said in a previous lecture In the real World, that situation is not quite convenient. If you are the owner of the project and you have some collaborators in your team, then you might need some control mechanism to check others work and avoid any unexpected results. To be more precise, get up close the owners of the repositories to protect the branches by requiring the reviews before merging the branches. All right, let's go ahead and figure out where I'm talking about. I'm going to protect the master branch. In most cases in the real world, the master branch is deployable and nobody touched it for testing proposes, so it should be protected to protect the branch. We have to go to settings and then we have to click branch. Here we see a little section called Branch Protecting Rules. Only right inside of the heading, we confined the bottom called at rule. Let's go ahead and click the button. So we've got here and input fields in which we should indicate the name off the branch and down below. We confined somewhere rule settings That's enter here, the name off the branch Master. After that, I'm going to take a year off the rule settings. So in this case, I want to use the first rule, which is require pull requests reviews before merging. So once we check this check box here, then all commits must be made to a non protected branch in this guy's the branch that is not master and have to be submitted via a pull request with the required number off approving reviews. In other words, people request can be accepted by the reviewer to merge the branches. As for the number off approving reviews, it should be selected from this drop down menu. In our case, we have just one collaborator. So as the number off approving reviews, I'm going to select one. Then finally click this green button here and create the rule. All right, so as a conceit now the rule applies to the master branch. Let's go back to the terminal and continue working. I want to remind you that currently I'm working from a different computer to imitate the process off collaboration properly. I'm going to add it. The index of html file. Let's create the paragraph with some Tommy text and then make a new committee with a message, added P. So now we need to push the change to get up. But we can't do it over the master branch because it's protected. If I run, get push origin Master, then we will get an error because, as we said, the massive branch is protected. So what should we do? We have to create a new branch, push it to the get up and then merge eight to the master branch. So let's go ahead and create a new branch for that. Let's run, get check out Dash B, followed by the name of the branch. Let's say test as remember these command close is to create a new branch and switch to it at the same time. Let's around the history. So here we have all the commits which have been made so far, I'm going to add a new committee on the test branch. Let's change the phone size of the paragraph, make it 30 pixels and then make a new committee you with the message. Increased phone size off peak. Finally, let's run the history as you see the test branches. One. Commit ahead off the massive brunch. All right, so now we can push the changes over that newly created branch on get up, run again, gets pushed origin and then indicate here the name of the branch test. So once this command is run, if we go to the collaborators account, we will find here the pushed test branch in a slightly different color. So now we have to compare changes and create a put request. Let's go ahead and click this button here. Then I'm going to change here. The comments. That's until he added on Styled Pete and then click the button to create the pull request. So, no, we've got here some warnings. The 1st 1 says that the review is required. As for the 2nd 1 it says that the merge is blocked, and also you can see that we're not able to merge the port request because the bottom is to say, Let's go and check the owner's account. Reload the page as you see, we have here one full request. Let's go ahead and open it. You can find here the same warnings review is required and merging is blocked. But despite this, I can still Merced people request as the owner off the report story. All right, so what should we do? First of all, we have to set the reviewer I mean the user which will review the changes and approve the pull request here on the right hand side of the page, we say the reviewers section also here is a hint saying that at least one approving review is required to merge these pull requests that comes from the rule settings which we have just set up. Let's go ahead and set the reviewer for that. We have to click this icon here, As you can see, get help suggests automatically to set the owner off the report as a reviewer. Let's select it. After that, we have to go to the files change top where we can find all the changes made by the collaborator. So, after reviewing the changes, if the owner is happy with them that he or she should approve them at the top right corner . Off the section, we can find a green button called review changes. If I click it, then the input field will be displayed with some options. I mean, the options, like comment approved on request changes in this guys, we have to select a proof also. Let's adhere some comments. Good job and click submit a review. So now the owner off the project has approved the changes made by the collaborator, and we can simply merge the request. If we check the committee Serie we will find all the commits made by the collaborator, followed by the merge. Commit the salmon confined. If we checked it. Collaborators account. All right, Some of that's the way how we can protect the branches and control collaborators. Work on Gibson. Okay, congratulations. We're done. And our course is over. I hope it was interesting you enjoyed it and learn lots of different things regarding get and get up. Nowadays, every developer should know how to deal with the most popular and widely used version control systems. After finishing this course, you will have all the needed skills and knowledge about Kate and get up. I want to remind you that you have lifetime access on the course, so you can come back any time, recalled some important topics about get and get up and also fall. All the updates for this course. All right. Thanks for being with us. We should all the best. Bye bye.