What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutorial | Edureka

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is Rachel from eddy Eureka and today's tutorial we're going to learn about git and github now if you're someone who's new to coding and you might be hearing your fellow developers talking about git and github but you don't know what they actually are and you have never used it then this tutorial my friend is just for you and even if you are one of those people who have been using git and github for a while but you're a little doubtful that there might be some kind of get features that you have left unexplored then I'll just tell you just hang in there till the end of this tutorial and please let me know if you have learned something new so I would like to welcome and thank all the attendees for joining today's session but before I begin am i audible to everyone so john says yes so without any further ado let us begin this tutorial by looking at the topics that we'll be learning today said first we'll see what is version control and why do we actually need version control after that we'll take a look at the different version control tools and then we'll see all about github and git will also take an account a case study of the dominant enterprises about how they're using github after that we'll take a look at the features of git and finally we're going to use all the git commands to perform all the git operations so this is exactly what we'll be learning today so is the agenda clear to everyone so John says yes Tyler says yes so we're good to go let us begin with the first topic what is version control well you can think of a version control as the management system that manages the changes that you make in your project till the end the changes that you make might be some kind of adding some new files or you're modifying the older files by changing the source code or something so what the version control system does is that every time you make a change in your project it creates a snapshot of your entire project and save it and these snapshots are actually known as different versions now for having trouble with the word snapshot just consider that snapshot is actually the entire state of your project at a particular time it means that will contain what kind of files your project is storing at that time and what kind of changes you have made so this is what a particular version contains now if you see the example here let's say that I have been developing my own website so let's say that in the beginning I just had only one webpage which is called the index dot HTML and after a few days I have added another web page to it which is called about dot HTML and I have made some modifications in the about dot HTML by adding some kind of pictures and some kind of text so let's see what actually the version control system stores to see that it has detected that something has been modified and something has been created for example it is storing that about dot HTML is created and some kind of photo is created or added into it and let's say that after a few days I have changed the entire page layout of the about dot HTML page so again with version control system will detect some kind of change and will say that some about dot HTML has been modified and you can consider all of this three snapshots as different versions so when I only have my index or HTML web page and I do not have anything else this is my version 1 and after that when I added another web page this is going to be a version 2 and after have changed the page layout of my web page this is my version 3 so this is how a version control system stores different versions so I hope that you've all understood what is a version control system and what are versions so if you have any kind of doubts you might ask me and if not give me quick confirmation on the chat window so that I can move on to the next topic ok so John has a question he asks that can we go back to a previous version if you make a mistake yes of course that is the whole purpose of a version control system because sometimes you make changes and you don't want them so a version control system always keeps your older versions neat packed inside it only because if at anytime sometimes you want to roll back to the previous version you can do that that is the whole purpose of maintaining your version virtual system I hope John you have got your answer okay Seth yes thank you so much so let us move on to the next topic and now we'll see why do we actually need version control because you might be thinking that why should I need a version control I know what the changes that I have made and maybe I'm making this changes just because I'm correcting my project or something but there are a number of things because of why we need version control and so let us take a look at them one by one so the first thing that version control system availeth is collaboration now imagine that there are three developers working on a particular project and everyone is working in isolation or even if they're working in the same shared folder so there might be conflicts sometimes when each one of them are trying to modify the same file now let's say they are working in isolation everyone is minding their own business now the developer one has made some changes X Y Z in a particular application and in the same application the developer too has made some kind of other changes ABC and they are continuing doing that same thing they are making the same modifications through the same file but they're doing it differently so at the end when you try to collaborate or when you try to merge all of their work together you come up with a lot of conflicts and you might not know who have done what kind of changes and this will at the end end up in chaos but with version control system it provides you with a shared workspace and it continuously tells you who has made what kind of change or what has been changed so you'll always get notified if someone has made change in your project so with version control system a collaboration is a page between all the developers and you can visualize everyone's work properly and as a result your project will always evolve as a whole from the start and it will save a lot of time for you because there won't be much conflicts because obviously if the devil for a we'll see that he has already made some changes he won't go for that right because he can carry out his other words you can make some other changes without interfering his word so I hope that is understood how version control system evades collaboration if you have any questions you might ask me ok John says yes and Tyler says yes trainer says yes ok so we'll move on to the next reason for why we need version control system and this is one of the most important things because of why we need version control system I'll tell you why now the next reason is because of storing versions because saving a version of your project after you have made changes is very essential and without a version control system it can actually get confusing because there might be some kind of questions that will arrive in your mind when you are trying to save a version the first question might be how much would you save would you just save the entire project or would it just save the changes that you made now if you only save the changes it will be very hard for you to view the whole project at a time and if you try to save the entire project at every time there will be a huge amount of unnecessary and redundant data lying around because you'll be saving the same thing that has been remaining unchanged again and again I will cover up a lot of your face and after that the another problem comes that how do you actually name these versions now even if you are a very organized person and you might actually come up with a very comprehensible naming scheme but as soon as your project starts varying and it comes to variants there is a pretty good chance that you'll actually lose track of naming them and finally the most important question is that how do you know what exactly is different between these versions now you ask me that ok what's the difference between version 1 and version 2 what exactly was changed you need to remember or document them as well now when you have a version control system you don't have to worry about any of that you don't have to worry about how much you need to how do you name them or you have you don't have to remember that what exactly is different different between the versions because the version control system always acknowledges that there is only one project so when you're working on your project there is only one version on your disk and everything else all the changes that you've made in the past are all neatly packed inside the version control system and obviously like John asked that if you want to go back to the previous version if you're not sure that the modifications you've just made are right and you want to revert back you can do that with version control system as well because it is storing all your versions and you can always revert back so I hope that this is clear to everyone shall I proceed further guys okay so let us go ahead and see the next reason now version control system provides me with a backup now the diagram that is seen here is actually the layout of typical distributed version control system here you have got your central server where all the project files are located and apart from that every one of the developers have a local copy of all the files that is present in the central server inside their local machine and this is known as the local copies so what the developers do is that every time they start coding at the start of the day they actually fetch all the project files from the central server and store it in the local machine and after they are done working they actually transfer all the files back into the central server so at every time you will always have a local copy in your local machine at times of crisis like maybe let's say that your central server gets crashed and you have lost all your project files you don't have to worry about that because all the developers are maintaining a local copy the same exact copy of all the files that is related to your project that is present in the central server is there in your local machine and even if let's say that maybe this developer has not updated his local copy with all the files if he loses and the central server gets and the developer has not maintained a circle copy is always going to be someone who has already updated it because obviously there is going to be huge number of collaborators working on the project so even a particular developer can communicate with other developers and get fetch all the project files from other developers hope you copy as well so it's very reliable when you have a version control system because you're always going to have a backup of all your files so I hope this is clear to everyone so shall I move ahead ok so the next thing in which version control helps us is to analyze my project because when you have finished your projects you want to know that how your project has actually evolved so that you can make an analysis of it and you can know that what you have done better or what could have been improved in your project so you need some kind of data to make an analysis and you want to know that what is exactly changed and when was it change and how much time did it take and version control system actually provides you with all the information because every time you change something version control system provides you with the proper description of what was changed and when was it changed you can also see the entire timeline and you can make your analysis report in a very easy way because you have got all the data present here so this is how a version control system helps you to analyze your project as well so it is clear to everyone any questions on this ok so Sebastian says no all good so I hope it's clear to everyone else as well let us move ahead and let us take a look at the version control tools because in order to incorporate version control system in your project you have to use a version control tool so let us take a look at what is available what kind of tools can I use to incorporate version control system so here we have called the four most popular version control system tools and they are gift and this is what we'll be learning in today's tutorial we'll be learning how to use kit apart from good you have got other options as well you've got the Apache subversion and this is also popularly known as Sdn FCN and CVS which is the concurrent version systems they both are a centralized version control tool it means that they do not provide all the developers with a local copy it means that all the contributors or all the collaborators are actually working directly with the central repository on it they don't maintain local copy and it's kind of actually becoming obsolete because everyone prefers a distributed version control system where everyone has a local copy and mercurial on the other hand is very similar to get it is also a distributed version control tool but we're learning all about get here that's like it is highlighted in yellow so let's move ahead okay there's a question from Jamie so he asked that if all of them are open-source well I'll tell you that git is an open source okay so shall we proceed ahead Jamie and everyone else okay so this is the interest over time graph and this graph has been collected from Google Trends and this actually shows you that how many people have been using what at what time so the blue line here actually represents gives the green is SVN the yellows mercurial and the red is CDF so you can see that from the start it has always been the most popular version control tool as compared to SPN material and CVS and it has always kind of been a bad day for CVS but it has always been popular so why not use git right so there's nothing to say much about that and yes and a lot of my fellow attendees agree with me we should all use git and we're going to learn how to use creative this tutorial so let us move ahead and let us all learn about git and github right now so the diagram that you see on my left is actually the diagram which represents that what exactly is github and what exactly is git now I've been talking about a distributed version control system and the right hand side diagram actually shows you the typical layout of a distributed version control system here it is got a central server or a central repository now I'll be using the word repository a lot from now on just so that you don't get confused I'll just give you a brief overview I'll also tell you in detail what is the repository and I'll explain you everything later in this tutorial but for now just consider repository as a data space where you store all the projects files any kind of files that is related to your project in there so don't get confused when I say repository instead of server or anything else so in a distributed version control system you've got a central repository and you've got local repositories as well and every of the developers at first make the changes in their local repository and after that they push those changes or transfer those changes into the central repository and also they update their local repositories with all the new files that are pushed into the central repository by an operation called pull so this is how the fetch data from central repository and now if you see the diagram again on the left you know that github is going to be my central repository and git is the tool that is going to allow me to create my local repositories now let me exactly tell you what is github now people actually get confused between git and github they think that it's kind of the same thing maybe because of the name they sound very alike but it is actually very different well git is a version control tool that will allow you to perform all these kind of operations to fetch data from the central server and to just push all your local files into the central server so this is what git will allow you to do it is just a version control management tool whereas in github it is a code hosting platform for version control collaboration so github is just a company that allows you to host your central repository in a remote server if you want me to explain in easy words you can consider github as a social network which is very much similar to Facebook like only the difference is that this is a social network for the developers where in facebook you're sharing all your photos and videos or any kind of statuses what the developers do in github is that they share their code for everyone to see their project see their code about how they've worked on so that is good help ok I've got a question from Jamie and yes that are there any advantages over centralized versions control system over distributed version control system well of course there are certain advantages of a distributed version control system well the first thing that I've already discussed was that it provides you with the backup so if at any time your central server crashes everyone will have a backup of all their files and the next reason is that it provides you with speed because central server is typically located on a remote server you have to always travel over a network to get access to all the files so if at some times you don't have internet and you want to work on your project so that will be kind of impossible because you don't have access to all your files but with the distributed version control system you don't need internet access always you just need internet when you want to push or pull from the central server apart from that you can work on your own your files are all inside your local machine so fetching it in your workspace is not a problem so that are all the advantages that you get with a distributed version control system and a centralized version control system cannot actually provide you that so is it ok so did you get your answer Jamie ok so Jamie has asked another question how is the local repository connected to the cloud repository well I'll actually show you this you have to add an origin and you can it is also connected via SSH if you want to or you can send our HTTP request and connect to the central server as well so there are a number of ways to do it I will be showing you Jamie so Jamie have you got your answers okay Jamie says yes and I've got a couple of other questions as well okay so Sebastian has a question here he asked that so we do all the modifications and get and once it is done we'll push it to github and after that how can we automate this process well you can automate this process Sebastian you can use a Java settler or a Crone tab to automate all your push and pull operations but you kind of don't want to do that because the whole essence of having a local repository is that you are always free to make changes in the central repository when you want it because sometimes if you're not done working on a particular file and if you have just set a job scheduler it will automatically actually push your unfinished work and you don't want to do that because everyone else will see and it might actually interfere with the work and sometimes when you're pulling changes it actually updates your current workspace so if you're working on something and it's automatically pulling out the files and it's making changes automatically you might get confused but if you still want to do that it is possible you can use a job scheduler for that but I will advise you not to do that which is the whole purpose of having distributed version control system is that you can work in isolation and whenever you're sure that your code is working fine and you want others to see that then you can push it on to github so Sebastian have you got your answer okay Thank You Sebastian and thank you Jamie for asking questions and if any of you has any other questions you can always ask me so shall I proceed further ok so now let's take a look at a github case study of the Dominion enterprises so Dominion enterprises is a leading marketing services and publishing company that works across several industries and they have got more than 100 offices worldwide so they have distributed a technical team support to develop a range of a website and they include the most popular websites like forrent.com boats comm homes comm all the domain Ian's enterprises websites actually get more than tens of million unique visitors every month and each of the website that they work on has a separate development team and all of them has got a unique needs and you need to workflows of their own and all of them were working independently and each team has their own goals their own projects and budgets but they actually wanted to share their resources and they wanted everyone to see what each of the teams are actually working on so basically they wanted transparency well they needed a platform that was flexible enough to support a variety of workflows and that would provide all the Dominion enterprises development around the world with a secure place to share code and work together and for that they adopted github as the platform and the reason for choosing github is that all the developers across the Dominion enterprises we're already using github.com so when the time came to adopt a new version control platform so obviously a github Enterprise definitely seemed like a very intuitive choice and because everyone all the developers were also familiar with github so the learning curve was also very small and so they could start contributing or right away into github and with github all the developer teams all the development teams were provided access to when they can always share their code on what they're working on so at the end everyone has got a very secure place to share code and work together and as Joe fuller the CIO of Dominion enterprises says that github enterprises allowed us to store our company's source code in a central corporately control system and dominion enterprises actually manages more than 45 websites and it was very important for Dominion enterprise to choose a platform the made working together possible and this wasn't just a matter of sharing Dominion enterprises open source project and github they also had to combat the implications of soaring private code publicly to make their work more transparent across the company as well and they were also using Jenkins to facilitate a continuous integration environment and in order to continuously deliver their software they have adopted github as a version control platform so git have actually facilitated a lot of things for Dominion enterprises and for that they were able to incorporate a continuous integration environment with Jenkins and they were actually sharing their code and making software delivery even more faster so this is how github helped not only discriminate enterprises but I'm sure this might be common to a lot of other companies as well shall I move forward ok Jamie says it doesn't have any questions so let us move forward but if at any time if any kind of question arises you might ask me at all times so now this is a topic that we were waiting for and now we'll learn what is get so git is a distributed version control tool and it supports distributed nonlinear workflow forgetting the tool that actually facilitates all the distributed version control system benefits because it will provide you to create a local repository in your local machine and it will help you to access your remote repository to fetch files from there or push files into that so git is the tool that you require to perform all these operations and I'll be telling you all about how to perform this operation for using git later in this tutorial for now just think of git as the tool that you actually need to do all kind of version control system stuff so do you have any questions on what is git ok so jamie has a question can two people contribute in one local repository well a local repository resides in your local machine so now if two people are using the same machine obviously but you don't want that because every developer got their own machines so there's no use of create like having sharing a local repository it's all meant to work in isolation but if you want to create a subgroup let's say that these three collaborators are working on a similar kind of application of that project and these two are working on a little more similar but that's different to this and said so they want another repository before they're committing to the repository well you can do that as well you can place any other repository where in a few people can collaborate we're working in the entire project as well as for now the local repository here is the repository that actually resides in your local machine ok so jamie has another question here how's that how can I share commits with only a specific person without committing in the remote repo well no you cannot actually commit something in other persons repositories and only committed in your local repository and a remote repository so the remote repository is where everyone can see what changes you have made and what kind of commit you have made in the project and in the local repository the comment you made is only can be seen by yourself and the local repository is only meant for your use and after you make commits in the local repository then only you can make changes or transfers those changes into the remote repository but since all of you are connected over a network you might like hat you can take advice from your fellow collaborators but it cannot actually show the commits directly to him without committing into a remote repository where both of you have access to so Jamie's answer clear to you ok so Jamie says yes so we'll move on and we'll see the different features of git now so these are the different features of git is distributed get is compatible get a provider with a nonlinear workflow it avails you branching it's very lightweight it provides you with speed it's open source it's reliable secure and economical so let's take a look at all the features one by one so at first it is distributed okay so Sebastian asked the questions is that what is a collaborator actually is it a service well collaborator is a person who collaborates something in your work so this is pretty much like the English word where collaboration actually means it means our combined contribution so the collaborator when I'm saying collaborator I just mean a developer who has been working on the project so if there are a lot of developers working on the similar project and they're all contributing into the project I'm just naming them as collaborators so so in this tutorial when I'm saying collaborate I mean a person a developer who has been contributing his code so Sebastian is the answer clear to you okay Sebastian says got it Thank You Sebastian so the first feature that we're going to look into is its distributed now I've been like telling you it's the distributed version control tool it means that the feature that gets provides you is that it gives you the power of having a local repository and lets you have a local copy of the entire development history which is located in the central repository and it will fetch all the files from the central repository to get your local repository always updated and this I'm calling it distributed because every let's say that there might be a number of collaborators or developers so they might be living in a different parts of the world someone might be working from the United States and one live in India so the words the project is actually distributed everyone has a local copy so it is distributed worldwide you can say so this is what distributed actually means so the next feature is that it is compatible now let's say that you might not be using git on the first place but you have a different version control system already installed like SBN like a party subversion or CVS and you want to switch to get because obviously you are not happy with the centralized version control system and you want a more distributed version control system so you want to migrate from Sdn to get but you're worried that you might have to transfer all the files all the huge amount of files that you have in your SVN repository into a git repository well if you are afraid of doing that let me tell you you don't have to be anymore because git is compatible with SVM repositories as well so you just have to download and install git in your system and and it can directly access the SVN repository over the network which is the central repository so the local repository that you'll have is going to be a git repository and if you don't want to change your central repository then you can do that as well we can use git sdn and it can directly access all the files all the files in your project that is residing in an SVM depository so you don't have to change that and it is compatible with existing systems and protocols but there are protocols like SSH and winner in protocol so obviously get users SSH to connect to the central repository as well so it is very compatible with all the existing things so you don't have to so when you're migrating into kit when you were starting to use git you don't have to actually change a lot of things so if I have everyone understood these two features by so far okay the next feature of git is that it supports nonlinear development of software now when you're working with get it get actually records the current state of your project by creating a tree graph from the index a tree that you know is nonlinear now when you're working with git it actually records the current state of the project by creating a tree graph from the index and as you know that a tree is a nonlinear data structure and it is usually actually in the form of a directed acyclic graph which is popularly known as the daj so this is how actually get facilitates a nonlinear development of software and it also includes techniques where you can navigate and visualize all of your work that you're currently doing and how does it actually facilitate and when I'm talking about non-linearity how does it get actually facilitate a nonlinear develop is actually by branching now branching actually allows you to make a nonlinear software development and this is a good feature that actually make it stand apart from nearly every other version control management tool because git is the only one which has a branching model so git allows and it actually encourages you to have a multiple local branches and all of the branches are actually independent of each other and the creation and merging and deletion of all these branches actually takes only a few seconds and there is a thing called the master branch it means the main branch which starts from the start of your project to the end of your project and it will always contain the production quality code it will always contain the entire project and after that it is very lightweight now you might be thinking that since we're using local repositories on our local machine and we're fetching all the files that are in the central repository and if you think that way you can know that there are like honey there are hundreds of people pushing their code into the central repository and I'm updating my local repository with all those files so the data might be very huge but actually good uses a lossless compression technique and it compresses the data on the client side so even though it might look like that it's got a lot of files when it actually comes to storage or storing the data in your local repository it is all compressed and it doesn't take up a lot of space only when you're fetching your data from the local repository into your workspace it converts it and then you can work on it and whenever you push it again you compress it again and store it in a very minimal space in your disk and after that it provides you with a lot of speed now since you have a local repository and you don't have to always travel over a network to fetch files so it does not take any time to get files in your into your work space from your local repository because and if you see that it is actually hundred times faster detecting data from a remote repository because because obviously have to travel over the network to get that data or the files that you want and Mozilla has actually performed some kind of performance test and it is found out that git is actually one order of magnitude faster than other version control tools which is actually equal to ten times faster than other version control tools and the reason for that is because git is actually written in C and C is not like other high-level languages it is very close to machine language so it reduces all the runtime overheads and it makes all the processing very fast so get is very small and a get is very fast and the next feature is that it is open source well you know that it was actually created by Linus Torvalds and he is the famous man who created the Linux kernel and he actually used git in the development of the Linux kernel now they were using a version control system called bitkeeper first but it was not open source day so the owner of bitkeeper has actually made it a paid version and this actually got Linus Torvalds mad so what he did is that he created his own version control system tool and he came up with git and he made it open source for everyone so that you can so the source code is available and you can modify it on your own and you can get it for free so there is one more good thing about git and after that it is very reliable like I've been telling you since the Stars that a have a backup of all the files in your local repository so if your central server crashes you don't have to worry your files are all saved in your local repository and even if it's not in your local repository it might be in some other developers local repository and you can tell him what and whenever you need from that data and you lose the data and after your central server is all repaired if it was crashed he can directly push all the data into the central repository and from there everyone else can always have a backup here and Sebastian says I guess even they would have a backup for central repository yeah you can do that it you are not if you think that your developers are not trustworthy enough that they might not be pulling codes regularly and you want to make sure that you don't have to actually contact each of the collaborators or the developers on events like this you can always maintain a duplicate copy of your central repository but if you don't want to waste more money or more space you can always rely on your developers as well but if you want to do it and I think it is advisable to have a duplicate copy of your central repository like Sebastian you said you can do that as well okay so and Sebastian are you satisfied with my answer okay says yes so the next thing is that kid is actually very secure now git uses the sha-1 do name and identify objects so whenever you actually make change it actually creates a commit object and after you have made changes and you have committed to those changes it is actually very hard to go back and change it without other people knowing it because whenever you make it commit the sha-1 actually converts it well okay so Jonathan what is sha-1 well it is a kind of cryptographic algorithm it is a message digest algorithm that actually converts your commit object into a 40 digit hexadecimal code now sha I uses techniques and algorithms like md4 and md5 and it is actually very secure it is considered to be very secure because even the National Security Agency of the United States of America uses SSA I so if they're using it you might know that it is very secure as well and if you want to know what 75 and message digest I'm not going to take you through the whole algorithm whole cryptographic algorithm about how they make that cipher and all you can google it and you can learn what it is hei but the main concept of it is that after you have made changes you cannot deny that you have not made changes because it will store it and everyone can see it it will create a commit for you so everyone will see it and this commit hash in is also useful when you want to revert back to previous versions you want to know that which commit exactly caused what problem and if you want to remove that commit if you want to remove that version you can do that because sha I will give you the hash log of every covet okay so Jamie ask any revert back to the previous commit of course we can avert back to a previous commit you can see what was exactly changed and if you want Jamie I can show you that in a while that I can revert back to a previous commit okay so Jamieson is cool so let's move on and see the next feature which is economical now git is actually released under the general public's license and it means that it is for free you don't have to pay any money to download get in your system you can have kid without burning a hole in your pocket and since all the heavy lifting is done on the kind side because everything you do you do it on your own entire workspace and you push it into the local repository first and after that it's pushing the central server so it means that people are only pushing into the central server after when they're sure about the work and and they're not experimenting on the central repository so your central repository can be very simple and if you don't have to worry about having a very complex and very powerful hardware and a lot of money can be saved on that as well so to get a free get is small so git provides you with all the cool features that you would actually want so this were all the gift features if you have any questions on that you might ask me and if not we'll go ahead to the next topic okay so we'll go ahead to the next topic our next aisle so first we'll see what is a repository now as github says it it is a directory or storage space where all your projects can live it can be local to a folder on your computer like your local repository or it can be a storage space and github or another online host it means your central repository and it can keep your code file sticks image files you name it you can keep it inside a repository everything that is related to your project and like I have been chanting since the start of this tutorial that we have got two kinds of repositories we've called the central repository and we've called the local repositories and now let us take a look at what this repulsive trees actually are so on the left-hand side you can see all about the central repository and in the right hand side this is all about my local repository and the diagram in the middle actually shows you the entire layout so the local repository will be inside my local machine and my simple repository for now is going to be on github so my central repository is typically located on the remote server and like I just saw earlier if typically located on github and my local repository is going to be my local machine as we slide in as in a dot git folder and it will be inside your project root the dot git folder is going to be inside your project's root and then you contain all the templates and all the objects and every other configuration files when you create your local repository and since you're pushing all the code your central repository will also have the same dot git repository folder inside it and the sole purpose of having a central repository is so that you're all the collaborators or all the developers can actually share and exchange state data because someone might be working on a different problem and someone might be needing help and that so what he can do is that he can push all the code all the problems that he has solved or something that he has worked on into the central repository and everyone else can see it and everyone else can pull his code and use it for themselves as well so this is just meant for sharing data where is in local repository it is only you can access it and it is only meant for your own so you can work in your local repository you can work in isolation and no one will interfere you and after you're done after you're sure that your code is working and you want to show it to everyone just transfer it or push it into the central repository okay so now we'll be seeing the gate operations and commands this is how we'll be using it there are various operations and commands that will help us to do all the things that we were just talking about right now we're talking about pushing changes so these are all get operations so we'll be performing all this operations will be creating repositories with this command will be making changes in the files that are in our repositories with the commands will be also doing parallel nonlinear development that I was just talking about and also this thinking of repositories so that our central repository and local repository are connected so I'll show you how to do that one by one so let's start but before that has anyone got any kind of questions or shall I just move forward okay so Sebastian says move forward no doubts and so let us move forward and see these operations one by one so the first thing that we need to do is create repositories so we need a central repository and we need a local repository now will host our central repository on github so for that you need an account and github and create a repository there and for your local repository you have to install git in your system and if you are working on a completely new project and if you want to start something fresh and very new you can just use git init to create your repository or if you want to join an ongoing project and if you're new to the project and you just join so what you can do is that you can clone the central repository using this command git float so let us do that so let's first create a github account and create the positives on github so at first you need to go to github.com and if you don't have an account you can sign up for github and here you just have to take a username that has not been already taken you have to provide your email address get a password and then just click this green button here and your account will be created it's very easy don't have to do much and after that you just have to verify your email and everything and after you're done with all sort of thing you can just go sign in I will already have an account so I'm just going to sign in here so after you're signed in you'll find this page here so you'll get two buttons where you can read the guide of how to use github or you can just start a project right away now I'll be telling you all about github so you don't have to click this button right now so you can just go ahead and start a project so now git tails that for every project you need to have you need to maintain a unique repository it is because it's very healthy and keeps things very clean because if you are storing just the files related to one project in a repository you won't get confused later so when you're creating a new repository you have to provide with a repository name now I'm just going to name it get - github and you can throw it with the description of this repository and this is optional if you don't want you can leave it blank and you can choose whether you want it public or private now if you want do it to be private you have to pay some kind of amount so like this will cost you $7 a month and so what what is the benefit of having a private account is that only you can see it if you don't want to share your code with anyone and you don't want anyone to see it you can do that and github as well but for now I'll just leave it public I just want it for free and let everyone see my work what you have done so what's the fee with public for now and after that you can initialize this repository with the readme so the readme file will contain the description of your files this is the first file that is going to be inside a repository when you create the repository so and it's a good habit to actually initialize your repository with the readme so I'll just click this option and this is the option to add git ignore now there might be some kind of files that you don't want when you're making operations like push or pull you don't want those files to get pushed or pulled like it might be some kind of log files or anything so you can add those files and get ignore here so right now I don't have got any files so this is just the starting of her project so I will just ignore this get ignore for now and then you can actually add some license as well so you can just go through what this license actually are but if you want to just leave it as none and after that just click on this green button here so just create your repository and so there it is so you can see this is the initial commit you have initialized your repository with the readme and this is your readme file now if you want to make changes into the readme file just click on it and click on the Edit pencil image or I can kind of that is in here and it can make changes on the readme files if you want to write something let's say just write a description judges if for tutorial focus and that's just keeping it simple and after that you've made changes the next thing that you have to do is you have to commit a changes so you can just go down and click on this commit changes green button here and stuff so you have updated we need our MD and this is your commit hash so you can see that in here is to go back to your repository you can say that something has an update and to show you when was your last commit should even show you the time so and for now you're on the branch master here and this will actually show you all the logs so since only I'm contributing here so this is only one contributor and I've just made to commit the first one was when I initialized it and right now when I modified it and right now have not created any branches so there is only one branch so now my central repository hasn't created so the next thing that I need to do is create a local repository in my local machine now I have already installed get in my system I have using a Windows system so I've installed it for Windows so if you want some help with the installation I have already written a blog on that I'll leave the link of the blog in the description below you can refer to that blog and install get in your system now I've already done that so let's say that I want a project to be in the feed drive so let's say I'm just creating in folder here for my project so just name it add your acre project and let's say that this is where I want my local repository to be so first thing that I do is right-click and I'll click this option here get bash here and this will actually open up a very colorful terminal for you to use and this is called the git bash emulator so this is where you'll be typing all your commands and you'll be doing all your work in get back here so in order to create your local repository the first thing that we'll do is type in this command get in it and press Enter so now you can see that it is initialized empty git repository on this pot so let's see and you can see that a dot git of a folder has been created here and you see here you'll see you can see that it contains all the configurations and the object details and everything so your repositories initialized and this is going to be your local repository so any questions on how to create repositories as you saw John says no so after we have created our repositories it is very important to link them because how would you know which repository to push into and how will you just pull all the changes or all the files from a remote repository if you don't know if they are not connected properly so in order to connect them with the first thing that we need to do is that we need to add a region and we're going to call our remote repository as origin and we'll be using the command git remote add origin to add so that we can pull files from our github or central repository and in order to fetch files we can use git pull and if you want to transfer all your files or push files in the github will be using git push so let me just show you how to do that so we're back in a local repository and as you can see now that have not got any kind of files and if you go to my central repository you can see that I've got a readme file so the first thing that I need to do is to add this remote repository as my origin so for that I'll clear my screen first so for that you need to use this command git remote add origin and the link of your central repository and let me just show you where you can find this link so when you go back into your repository you'll find this green button here which is the clone or download just here and this is the HTTP URL that you want to just copy it on your clipboard go back to your git bash and paste it and enter so your origin has been added successfully because it's not showing any kind of errors so now what we'll do is that will perform a git pull it means we'll fetch all the files from the central repository into my local repository so just type in the command git pull origin master and you can see that they have done some guys fetching from the master branch into the master branch and let us see that whether all the files have been fetched or not let us go back to our local repository and there is the readme file that was in the central repository and now it is in my local repository so this is how you actually update your local repository from the control repository you perform a git pull and it will fetch all the files from the central repository in your local machine so now if you want to push changes you can use git bush okay so I have a question from Sebastian he said that the file when you're pulling it is it in the compressed format well actually when you're storing the files in your central repository that files are actually all compressed so when you're pulling it it comes in the compressed format as well but while when you're actually including it in your workspace or in your staging area then it unpacks all the files and you can use it but while and after you have done committing and you have pushed that in your local repository it is again compressed but while you are working with that in your workspace it is in the uncompressed format so Sebastian have you got your answer so let us move forward and move ahead to the next operation now I've told you in order to sync repositories you also need to use a git push but since we have not done anything in our local repository now so I'll call the good get push later on after I show you all the operations and we'll be doing a lot of things so at the end as we performing the git push and push all the changes into Munson's repository and actually that is how you should do that the it's a good habit and it's a good practice if you're working with github and git is that when you start working the first thing that you need to do is make a git pull to fetch all the files from your central repository so that it could get updated with all the changes that have been recently made by everyone else and after you're done working after you're sure that your gold is running then only make the git push so that everyone can see it you should not make very frequent changes into the central repository because that might interrupt the work of your other collaborators or other contributors as well so let us move ahead and see how we can make changes so now kit actually has a concept it has intermediate layers that resides between your workspace and your local repository now when you want to commit changes or make changes in your local repository you have to add those files in the index first so this is the layer that is between your workspace and local repository now it's your files are not in the index you cannot make commits or you can apps cannot make changes into your local repository so for that you have to use the command git add and you might get confused that which all files are in the index and which all are not so if you want to see that you can use the command git status and after you have added the changes in the index you can use the command git commit to make the changes in the local repository now let me tell you what is exactly a git commit everyone will be talking about git commit committing changes when you're making changes so let us just know what is a git commit so let's say that you have not made any kind of changes or this is your initial project so what a comet is is that it is a kind of object which is actually a version of your project so let's say that you have made some changes and you have committed those changes what your version good your system will do is that it will create another comet object and this is going to be your different version with the changes so your comet snapshots are actually going to contain snapshots of the project which is actually changed so this is what commit is so I'll just show you I'll just go ahead and show you how to commit changes in your local repository so we're back into our local repository and so let's just create some five years so now if you're developing a project you might be just only contributing your source code files into the central repository so now I'm not just going to tell you all about coding so we're just going to create some text files write something in that which is actually pretty much sane if you're working on a code and you were storing your source code in your repositories so I'll just go ahead and create a simple text file I'll just name it a d1 just write something and I'll just write first file save this file close it so now remember that even if I have created inside this repository this is actually showing my workspace and it is not in my local repository now because I have not committed it so what I'm going to do is that I'm going to see what all files are in my index but before that I'll clear my screen because I don't like junk on my screen okay so the first thing that we're going to see is that what all files are added in my index and for that I just told you we're going to use the command git status so you can see that it is calling Eddie one dot txt which we just have written it is calling it an untracked file now untracked files are those which are not added in the index yet so this is newly created I have not added it explicitly into the index so if I want to commit changes in Eddie 1 dot txt I will have to add it in the index so for that I'll just use the command git add and the name of your file which is Eddie 1 dot txt and it has been added so now let us check the status again so for that we'll use git status and you can see that change is ready to be committed is the Eddie wonder txt because it's in the index and now you can commit changes on your local repository so in order to commit the command that you should be using is gift commit - M because whenever you are committing you always have to give a commit message so that everyone can see you who made all this commits and what exactly it is so this commit message is just for your purpose that you can see what exactly was changed but even if you don't write it the version control system is also going to do that and if you have configured your kit it is always going to show that who is the user who has at this change okay so Sebastian has a question yes that can I add a whole folder in the index well of course you can you can add all the multiple files at one go I'll just show you how the best technical one just because I had only one file so I just added it explicitly and yeah Jamie also has the same kind of questions can we add multiple files and then commit instead of one file of course you can do that I'll show you how to do that and Sebastian and Jamie will just because I had only one file so as I was just doing it explicitly one by one so let me just show you this one first and then I'll show you how to add multiple files into the index and come with them all at once okay so I was just talking about writing a commit message so I'm just going to write something like adding first commit in local group and press Enter so you can see once I'll change something has been inserted so this is the changes are finally committed in my local repository and as you want to see how actually get stores all this commit with actually I'll show you after I show you how to commit multiple files together so let's just go back into our local Beppo folder and we just create some more files more text files you can name it at you too let's create another one and the same it at your three let's just write something over here we'll just say second file first time so let's go back to our get Bosch terminal and now let us see the gifts status so now you can see that it is showing that Eddie - and Eddie 3 are not in my index and if you remember anyone was already in the index actually let me just go back and make some modifications in Eddie 1 as well so I'm going to write modified 1 so you'll just see get status again and you can see that it is showing that anyone is modified and there are untracked files Eddie - and Eddie 3 because I haven't added them in my index yet so now Sebastian Jamie you have been asking me how to like a doll multiple files together so now I'm going to add all these files at once so for that I'm just going to use get at - kappa ta just press enter and now see the git status and you see that all the files have been added to the index at once and it similarly with commit as well so now that you have added all the files in the index I can also commit them all at once and how to do that let me just show you you just have to write git commit and - small a so so if you want to commit all you have to use - small a in case of git commit whereas in case of get add if you want to add all the files you have to use - capital e so just remember that difference an add message adding so you can see three files has been changed and now let me show you how this actually gets stores all this commits she can perform an operation called the KITT log and you can see so this is a forty digit hexadecimal code that I was thinking and talking about and this is the sha-1 hash and you can see the date and you have got the commit message that we have just provided where I just wrote adding three files together it shows it it shows the date and the exact time and the author and this is me because I've already configured it with my name so this is how you can see come in and this is actually how version control system like it actually stores all your commits so Jamie asks can I commit without em flag well yes you can remove the EM flag but then what will happen is that it will there is going to be a prompt window asking you for a commit message actually you cannot commit without providing a message now I don't want any other window or a command line to pop up in the screen and that is a very old-school VI editor where you have to like insert the command and then : WQ and exit so instead of that I will just not use a simple M flag and provide my message in potations but Jamie if your question was if you can come in without a message no you cannot you always have to provide a message either this way or just with the window prompt where you can type in your message and enter so okay this clear to your Jamie and Sebastian okay so let us go back and see the next operation which is how to do parallel development or a nonlinear development and the first operation is branching now we've been talking about branching a lot and let me just tell you what exactly is branching and what exactly you can do with branching well you can think of branches like a pointer to a specific commit let's say that you have made changes in your main branch now remember that your main branch that I told you about it's called the master branch and the master branch will contain all the code so let's say that you're working on the master branch and you've just made a change and you have decided to add some new feature onto it so you want to work on the new feature individually or you don't want to interfere with the master branch if you want to separate that you can actually create a branch from this commit and let me show you how to actually create branches now a lot of study that there are two kind of branches there are local branches and remote tracking branches your remote branches are the branches that is going to connect your branches from your local repository to your central repository and local branches are something that you only create in your workspace that is only going to work with your with the files in your local repository so I'll show you how to create branches and then everything will be clear to you so let's go back to our git bash clear the screen and right now we are in the master branch and this indicates which branch you were on to right now so we're in the master branch right now and we're going to create a different branch so for that you just have to type the command kid branch and write a branch name so let us just call it first branch and enter now you have created a branch and and this first branch will now contain all the files that were in the master because it originated from the master branch so now the shows that you are still in the master branch and if you want to switch to the new branch that you just created you have to use this c'mon kids check out but it's called checking out is going to move from one branch to another it's called checking out and get so we're going to get check out and the name of the brush switch to first brush and now you can see that we're in the first branch and now we can start doing all the work in our first branch so let us create two more files in the first round so let's go back and this will actually show me my workspace of my first branch right now so we'll just create another text document and we're going to name it edu for and you can just write something first right to save it just go back and I was made some changes so let us just commit this changes all at once so let me just use get add after that what you have to do if you remember is that you have to perform a git commit and enter okay for one file change so now remember that I have only needs this add you for change in my first run and this is not in the master branch it because now we're in the first branch if it lists out all the files in the first branch you can see that you've got the Eddie one 8283 and the read movies within the master branch because it will be deprecated originated from the master branch and apart from that it has a new file called Eddie for dot txt and now if you just move back into the master branch at save we're going back into the master branch and if you just see the files MasterBrand you'll find that there is no adieu for because I've only need the changes in my first branch so what we have done now is that we have created branches and we have also understood the purpose of creating branches so do you have any doubts in how to create branches and why branches are needed or shall we just move on to the next topic ok so we're moving on to the next topic the next thing we'll see is merging so now if you're creating branches and you are developing a new feature and you want to add that new feature you have to do an operation called emerging emerging means combining the work of different branches altogether and it's very important that after you have branched off from your master branch always combine it back in at the end after you're done working with the branch always remember to merge it back in so now we have created branches let us see and we have made changes in our branch like we have added Eddy for and if you want to combine that back in our master branch because like I told you your master branch will always contain your production quality code ok so I've got a question from Jaime he asked that what is get stash now git stash is actually something that you can actually use when you're developing some kind of feature and and you don't want it yet you're not sure about that feature and you don't want to add it in a workflow yet so you have done some kind of work on that and you want to leave it and move on to another work you can actually get stash it so what good stash will do it is that it will break up your branch completely and store it differently and actually do it on your other work and you want to go back onto that so you can use git stash apply and reattach that branch or reattach that feature again in your development work so that is get stash so I'm not going to show you about like get stash right now because we're not actually developing a project or something so I'm just giving a brief idea so I hope that you have understood ok ok Jaime's so let us now actually merge start merging those files because of already created branches it's time that we merge them so we're back in my terminals and what we need to do is merge those changes and if you remember that we've got a different file in my first branch which is the Eddy four and it's not there in the master branch yet so what I want to do is merge that branch into my master branch so for that I'll use a command called git merge and the name of my branch and there is a very important thing to remember when you're merging is that you want to merge the work of your first branch into master so you want master to be the destination so whenever you're merging you have to remember that you were always checked out in the destination branch so I'm already checked out in the master branch so I don't have to change it back so I'll just use the command get merged and the name of the branch which word you want to merge it into and you have to provide the name of the branch whose work you want merged into the current branch that you were checked out so for now I've just got one branch which is called the first branch and enter so you can see that one file change something has been added we are in the master branch right now so now let us let out all the files in the master branch and there you see now you have add you four dot txt which was not there before I've merged it so this is what merging does now now you have to remember that your first branch is still separate now if you want to go back into your first branch and modify some changes again in the first branch and keep it there you can do that it will not actually affect the master branch until you merge it so let me just show you an example so let's go back to my first branch so now let us make changes in edu for I'll just write modified in first French we'll go back and we'll just commit all these changes and as you feel skit commit so now remember that the get commit all is also performed for another purpose now it doesn't only actually commit all the uncommitted file at once if your files are in the index and he has just modified it also does the job of adding it to the index again by modifying it and then committing it but it would work if you have never added that file in the index now Eddie for was already in the index now after modifying it I have not explicitly added in the index and if I'm using git commit all it will explicitly added in the index it will because it was already a tracked file and then it will commit the changes also in my local repository so you see I didn't use the command git add I just did it with git commit because it was already a tracked file so one file has been changed so now if you just just scat it and you can see that it's different it shows the modification that we have done which is modified at first branch now let's just go back to my master branch now remember that I have not merged it yet and my master branch also contains a copy of Eddie Ford and let's see what this copy actually contains so you see that the modification has not affected in the master branch because I have only done the modification in the first branch so the copy that is in the master branch has not it's not the modified copy because I have not merged it yet so it's very important to remember that if you actually want all the changes that you have made in the first branch all the things that you have developed in the new branch that you have created make sure that you merge it in don't forget to merge or else it will not show any kind of modifications so I hope that if understood or why merging is important how to actually merge different branches together so we'll just move on to the next topic and which is rebasing now when you say rebasing rebasing is also another kind of merging okay so before that I've got a question from Jamie he asked that what's the difference between get full and git fetch well the main difference is that when you do a git pull it actually pulls all the new files or the changed files from a central repository and it directly places them or connects them into your master branch and when you actually do a git fetch git fetch also does the same thing it just pulls or it just fetches all changed files or new files from the central level but it actually stores it in a different branch which is not connected with your current workflow so if you're doing a git fetch make sure that you do a git merge so that you actually can see the changes in your local repositories so you can say that git pull is equal to a git fetch plus a git merge so that is the main difference so Jamie have you got your answer ok he says yes so now let's get back to rebasing and as i was telling you that rebasing is another kind of merging so the first thing that you need to and standard rebase is that it actually solves the same problem as of get merge and both of this commands are designed to integrate changes from one branch into another and since that they just do the same task in a different way now what rebasing means if you see the workflow diagram here is that you've got your master branch and you've got your nybridge now when you re basing it what it does if you see in this workflow diagram here is that it's got a new branch and your master branch and when your rebasing it instead of creating a similar commit which will have two parent commits what rebasing does is that it actually places the entire commit history of your branch on to the tip of the master now you'd ask me why should we do that like what is the use of that well the major benefit of using our rebase is that you get a much cleaner project history now sometimes yes Sebastian is asking that is it done to reduce the number of branches yes of course because having so many branches together you might get confused if you have merged it or if something has been merged or not and you're reverting back so it's actually very happy third your workflow becomes a very haphazard and if you want to maintain a cleaner project history and if you want a linear workflow you can use freebasing for that and it also helps you to navigate better if you have a linear workflow right so this is the way that you can use rebase so I hope you've understood the concept of relays so let me just show you how to actually do rebasing okay so what we're going to do is that we're going to do some more work in our branch and after that we've eBay's our branch onto master so we'll just go back to our branch use git checkout first brunch and now we're going to create some more file view image ed u5 and let's say do you fix so we're going to write some random stuff absolutely welcome to where Eureka won all right the same thing again let's say welcome to so we've created this and now we're going back to our git bash and we're going to add all this new files because now we need to add because if we cannot do it with just get commit all because these are untracked files this is the files that I just created right now so I'm using and now we're going to commit and it has been committed so now if you just see all the files in C I do 1 2 3 4 5 6 and read me and if you go back to the master and if you just list out all the files and master it only has up to 4 the 5 and 6 are still in my first brush and I have not merged it yet and I'm not going to use git merge right now I'm going to use rebase this time instead of using git merge and this you'll see that this will actually do the same thing so for that you just have to use the command so let us go back to our first branch okay did a typing error IRS CDR K and ch okay switch the first branch and now we're going to use the command git rebase master now it is showing that my current branch first branch is up-to-date just because because whatever is in the master branch is already there in my first branch and there were no new files to be added so that is the thing so but if you want to do it in the reverse way I'll show you what will happen let's just go and check out master let's do releasing it rebase first branch so now what happened is that all the work of first branch has been attached to the master branch and it has been done linearly there was no need new set of commits so now as you see all the files as a master branch you'll find that you've got 85 and Eddy 6 as well which was in the first branch so basically rebasing has merged all the work of my first branch into the master but the only thing that happened is that it happened in the linear way all the commits that we did in first branch actually got reattached to the head in the master so have you all understood what rebasing is okay so I've got a confirmation from Jamie and John okay so should I go on forward so this was all about a nonlinear development I have told you about branching merging read thing that made changes with full changes committed changes but I remember that I haven't shown you how to push changes so since we're done working in our local repository now we have made our all final changes and now we want it to contribute in our central repository so for that we're going to use git push and I'm going to show you how to do a git push right now before I go ahead to explain you a git push you have to know that when you're actually setting up your repository if you remember you can't have repository as a public repository it means that you're giving a read access to everyone else in the github community so everyone else can clone or download your false profiles so when you're pushing changes and a repository you have to know that you need to have certain access rights because it is a central repository this is where you're storing your actual code so you don't want other people to interfere in it by pushing wrong codes or something so we're going to connect mice and repositories via SSH in order to push changes into my central repository now at the beginning when I was trying to make this connection with SSS or facing certain kind of problems let me go back to the repository let me show you when you click this button you see that this is your HTTP URL in order that you use in order to connect with yours and repository now if you want to use SSH so this is your SSH connection URL so in order to connect with SSH what do you need to do is that you have to generate a public SSH key and then just add that key simply into your github account and after that you can start pushing changes so first we'll do that will generate a ssh public key so for that we'll use this command s - fetch - qijin sender file there is already an SSH key so you want to override it yes so my SSH key has been generated and it has been saved in here so if I want to see it as a few scat and copy it so this is my public SSH key now if I want to add this SSH key I'll go back into my github account and here I will go back in settings and we'll go ahead and click on this option as to fetch and TPG keys and I've already had two SSH keys added and I want to add my new ones so I'm going to click this button new SSH key and just make sure that it provides a name to it I'm just going to keep it in order because I've named the other ones ssh-1 and SSS - just so I'm going to fit as 3 so just paste your switch key in here just copy this key paste it and click on this button which is add SSH key ok so now well the first thing you need to do is clear the screen and now what you need to do is you need to use this command at the search - T and your SEO search URL that we use which is get at the rate github.com and enter so my ssh authentication has been successfully done so i'll go back to my github account and if i refresh this you can see that the key is green it means that it has been properly authenticated and now I'm ready to push changes on to the central repository so we'll just start doing it so let me just tell you one more thing that if you are developing something in your local repository and you have done it in a particular branch in your local repository and let's say that you don't want to push this changes into the master branch of your tentacle or your github repository so let's say that whatever work that you have done it will stay in a separate branch in your github repository so that it does not interfere with the master branch and everyone can identify that it is actually your branch and you have created it and this branch only contains your work so for that let me just go to the github repository and show you something let's go to the repositories and this is the repository that I had just created today so when you go in the repository you can see that I have only got one branch here which is the master branch and if I want to create branches I can create it here but I would advise you to create all branches from your command line or sonica - only in your central repository as well so let us go back and branch so now what I wanted that I want all the work of the first branch in my local repository to make a new branch in the central repository and and that branch and messenger publisher will contain all the files that is in the first branch of my local repository so for that I'll just perform git push the name of my remote witches or written and first branch and you can see that it has pushed all the changes so let's verify it let us go back to our repository and let's refresh it so this is the master branch and you can see that it has created another branch which is called the first branch because I have pushed all the files from my first branch into and and I have created a new branch or first branch as similar to my first branch in my local repository here in github so now if we go to brunch you can see that there's not only a single master we have also called another branch which is called the first branch now if you want to check out this brand just click on it and you can see it has all the files with all the commit logs here in this branch so this is how you push changes and if you want to push all the change into master you can do the same thing let us go back to our branch master and we're going to perform a git push here but only what we're going to do this time is we're going to push all the files into the master branch and method for repository so for that I'll just use this git push origin okay so the push operation is done and if you go back here and if you go back to master you can see that all the files that were in the master branch and the local repo has been added into the master branch of my central ripple also so this is how you make changes and from your central repository to local repository so this is exactly what you do with git so if I have to summarize what I just showed you entirely in this when I'm when I was telling about git add and committing and pushing and police so this is exactly what is happening so this is your local repository this is your working directory so the staging areas are indexed the intermediate layer between your workspace and your local repository so you have to add your files into the staging area or the index with git add and you commit those changes with git commit in your local repository and if you want to push all this changes into the remote repository or the central repository where everyone can see it you use a git push and similarly if you want to pull all those files or fetch all those files from your github repository you can use git pull and you want to use branches if you want to move from one branch to another you can use git checkout as we want to combine the work of different branches together you can use git merge so this is entirely what you do when you're performing all these kind of operations so I hope it is clear to everyone does anyone have any questions on that and I remember Jamie you have often I think Sebastian Ying I've asked me that question to that how can we actually revert back to previous versions and I remember John has asked me that same question too when I was explaining about versions so I'll just show you how can you check out what has been and modifications so so just clear the screen and okay so let us go back to our terminal and just for experimentation purpose just to show you that how we can actually get revert back to our previous changes so now you might not want to change everything that you made in ed you wanted you to at use for or some other files that we just created so let's just go and create a new file modify it two times and revert back to the previous version just for demonstration purpose so I'm just going to create a new text file let's call it his word and now let us just type something hello let's just keep it that simple to save it and go back we'll add this file then come with this and say just call it revert one just remember that this is the first comment that I made with revert one and just so has been changed so now let's go back and modify this so after I've committed this file it means that it has toward a version with the text hello exclamation and my revert text file so I'm just going to go back and change something in here I'll just let us just add there hello there save it go back to our - now let us commit this file again because I've made some changes and I want a different version of the reverse file so we'll just go ahead and commit again so I'll use git commit all 6 River - and enter and it's done so now if I want to revert back to ok so now you just see the file you can see I've modified it so now it has got hello there let's say that I want to go back to my previous version I would just want to go back to when I had just hello so for that I'll just check my get log and you can check here that this is the commit log or to commit hash when I first committed revert it means that this is the version one of my revert now what you need to do is that you need to copy this commit hash now you can just copy the first eight hexadecimal digits and that will be it so just copy it whole clear the screen first you just need to go use this command git checkout and hexadecimal code are back to decimal digits that you just copied and the name of your file which is revert dot txt so you just have to use this command get checked out and the commit has that you just copy the first eight digits and you have to name the file which is revert dot txt so now when you just see this file you have to gone back to the previous commit and now when you just the status file you can see that now I've only got just hello it means that I have rolled back to the previous version because I have used the commit hash when I initially committed with the first change so this is how you revert back to a previous version so Jamie and John Sebastian has everyone understood how you can roll back to previous versions with git so do you have any questions ok so this is what we have learned today in today's tutorial we've understood what is version control and why do we need version controls and we've also learned about the different version control tools and in that we have primarily focused on git and we have learned all about git and github about how to create repositories and perform some kind of operations and commands in order to push pull and move files from wonderful the tree to another this also studied about the features of git and we also seen a case study about how the minion enterprises which is one of the biggest publishing company who makes very popular websites that we have got right now we have seen how they have used github as well so this is what we learned today I hope that it is helpful to you so does anyone have any kind of questions before I end this tutorial okay so everyone seems to be clear about everything so thank you everyone for joining today's session and if you have any kind of questions and queries or if there is any kind of feedback that you want to give me please mention it on the comment section below and I hope you enjoyed this tutorial and I'll see you next time till then happy learning thank you I hope you enjoyed listening to this video please be kind enough to like it and you can comment any of your doubts and queries and we will reply to them at the earliest to look out for more videos now playlists and subscribe to our red Rica challenge learn more happy learning
Info
Channel: edureka!
Views: 1,660,230
Rating: undefined out of 5
Keywords: yt:cc=on, git, github, what is github, what is git, git tutorial, git tutorial for beginners, github tutorial, github tutorial for beginners, git and github tutorial, git rebase, what is git rebase, what is git repository, learn git, git add, git branching, git bash, git commit, git merge, git push, git commands, git checkout, git config, git create repository, git flow, git init, git push origin master, git basics, git edureka, devops tutorial, devops tools, edureka
Id: xuB1Id2Wxak
Channel Id: undefined
Length: 104min 19sec (6259 seconds)
Published: Fri Feb 03 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.