in this G course for beginners Hest chowy will break down the essentials of Version Control to help you manage your projects more efficiently Hesh is a very popular instructor and in this tutorial he will teach you the tools and techniques you need to get started with get hey there everyone my name is hes and welcome to the YouTube channel I hope you are doing good and let's get started with another series that I really wanted to bring for so long but finally I got time to actually execute this in this entire series we are going to master git and the associated Services which are offered in the market some of them are quite popular and you might have heard about them such as GitHub bit bucket and there are plenty of others now in this entire series and the upcoming videos we'll be focusing on mastering the gate from both perspective the theoretical perspective as well as the Practical perspective every year there are thousands and thousands of Engineers who walk into the domain of software Eng engineering and realize that building a software is not that easy as it looks like it requires a lot of patience as well as a lot of tools are required to actually build these softwares there are a lot of other Engineers as well whom which you want to collaborate and work on a single software and of course there are days on which software works and of course there are days on which software doesn't work and for these kinds of special situation we need checko so that we can go back in the time where things were working absolutely fine and we can just start from there again can it is almost like saving a game just like we have checkpoints in the game exactly like that we can have checkpoints in the software as well this whole thing is known as version control system or the versioning system in the software industry and I just really feel that every year thousands of engineer walks into this domain and want to really Master this a lot of tutorial which are recorded uh previously or years before they look a little outdated uh of course the technology is same but of course the delivery part the content creation the videos they all need to upgrade from time to time and this is exactly why I am recording this fresh series for all the engineers who are just getting started or want to learn git this is a fantastic series and you're going to absolutely love this one now the my goal is not to make sure that you memorize all the thousands and gazillions of commands which comes through the gate but actually you understand the flow of how a software is designed and work along with me the idea behind this series is not to understand thousand commands but actually to understand how the workflow of a git works when we actually design a software what happens when things goes wrong what happens when things goes great and what's there inside and what's there behind the scene in the git which is all we want to learn for this we are going to use a mix of theory as well as practical and yes a lot of uh tutorials goes really heavy on the practical but that is exactly the point where you miss the behind the scene detail of what happens behind the scene in the git what what is there in that git folder and how we can actually study it this tutorial and this entire series is going to be a mix of all of it and I'm pretty sure you're going to enjoy this now in order to get started you don't need too much now that you have the basics of what this all is going on we need just a couple of software that we're going to talk about and we we'll go through with the documentation but as a preparation side let me just share my screen so that I can walk you through that what all softwares we are going to need first of all about the notes uh yes these are my handwritten notes that I prepared and we'll be walking through with these that how things goes on it's much more easier to teach in the classical style of pen and paper and we will be doing that but don't worry we will also have the Practical aspect of it and for the Practical aspect of it we don't need too much of the softwares I'll just tell you what are my favorite ones and you can just pick whatever you like and since git is one of the thing which I 100% still believe is a terminal First Tool there are a lot of guiz as well the guis graphical user interface but I still believe that you actually thrive in the industry of the gate via the command line it might look add daunting first but it is not it is absolutely easy to work with this and for the terminal I'm going to be using warp this is my default terminal these days I'm actually absolutely loving this the command line it is something which is redesigned terminal was something which was never redesigned and here's a good thing about it the software if you look at here uh this one it is available for Mac it is available for Linux and they are all already working on windows so by the time you might be watching the window video uh there might be already a Windows version and it is absolutely a charm by the way if you don't like it you can use any terminal but I'll be using this one I find this much more easier to work on with apart from this we'll be also using visual studio code that's it that's going to be our code editor the best part is we will not be writing any code at all but still I highly recommend to use this one this entire series is going to be language independent since we want to master the git and not a programming language so we will not be writing any programming language we'll be writing just the text data so that we can understand what goes on what goes behind the scene and all these details so these are the two softwares that are going to be required for you and that is all that is all what you need to get started with this series now one thing I would like to mention here in the very next video we'll go ahead download the git and we'll walk you through a couple of documentation and what to avoid in that documentation it is absolutely a jungle if you just walk into that apart from this please make sure you understand and git and GitHub are two very different thing one is a service provider and one is a software in itself git is a software that we want to learn and one of the services is GitHub of course we'll do uh we'll go there and we'll Deep dive into this one but there are plethora of other services available there as well so make sure you understand the difference between them and that's all the basics to get started I hope that's a good introduction for you what's about to come and what's going to be there in the series itself uh that's it for this video let's go ahead and move on to the next one and uh just set up everything and let's get started and let's dive deep into the world of git hey there everyone a here back again with another video and welcome to the series on the git so let's go ahead and get started finally with the git and let me walk you through how we're going to deal with this entire thing first reminding you again that this series is not about memorizing every single sing command that's available with the git but of course to understand the workflow and some of the behind the scene details of how git properly works so it's going to be a mixed balance of the theory as well as the Practical and I highly recommend to follow along uh because you're going to learn so much when you type these commands uh with your own hands on the keyboard it's a much better learning experience so try them out so let's go ahead and get started let me show you the setup of how we are going to proceed into this one so this is where our browser lies and we will not be focusing too much on the browser because majority of the things that we require or we need to understand to study the documentation will be covered up in this video only and from the next video onwards uh we'll be focusing majorly on the terminal now git is available uh on the GUI platform as well but I think the more you understand about the commands and how they work the better you will be performing on those guis as well on the other screen we do have our handwritten notes here as well uh they are so much better way of teaching uh the subject I still believe that and this series is going to be a mix balance of how to proceed the entire flow of the applic flow of the series as well as the theoretical knowledge I know a lot of you are big fan of just show me the practical but once you understand the behind the scene details The Learning Journey is much much better and you'll be remembering it throughout your life that's the experience I want to give you that once you understand the git from here that's it you are done for the lifetime so coming back first what we're going to do is uh we're going to go back onto this so in order to get this by the way if you want to grab the terminal the exact one that I'm using it's warp uh again common question that comes around uh now let's go on to the git so if you want to go and download the git the website is g-m uh the source control manage management software that we are going through and this is the homepage that you're going to see if you look at the download it will automatically detect your system and will give the software for you you can also click on the download and get the Mac Linux or Windows version whichever you like it is pretty easy to install it's really simple all you have to do is just open up the file and next next I agree okay that's all you have to do and remember the one thing that this is the software that you're installing just because you have installed the software doesn't means that we using the software it's just the installation process the learning of the software how it works that we're going to go through together also you're going to see that on the homepage there's a documentation guide as well now this is the most confusing part because if you click on the documentation and click on the reference manual it looks like that hey it's a pretty small documentation but it is absolutely a jungle if you just look at the git or even the git config you'll find that it is unreadable it is so much of in-depth and so much of the things yeah look at the scroll bar on the right yeah you got this one so it is so much that it is almost impossible to go through with this I don't call this as a documentation it is more of a reference manual whatever you need is there but it is almost impossible to learn from this documentation this is more of a reference guide if you ever need to explore some things more so answer is there but it's not easy to find that now coming back uh let's go ahead and on to this one so first and foremost I have created a folder where we're going to keep all of our learning materials and all of that it's not really that big that I should give it to you while the GitHub account or something it's really the text file so first and foremost I'm going to type the CD and we'll be going to a very specific folder I'll just drag and drop this folder here so it automatically picks up that folder I'll go ahead and hit an enter so now I'm into this folder there is absolutely nothing into this one let's go ahead and create couple of directories into this one so you can see that mkd and we're going to call this one as git one and we're also going to call this one as git 2 and do we need three as well let's just go ahead and have this one so now I have three folders inside this one git 1 2 and three now assume these are just regular folder no assumption no techniques nothing right now uh just a quick question do you think that the software that I've installed git might be somehow associated with these folders absolutely not it is not possible for them that's exactly what I'm saying git is just a software in order to make sure that git tracks what's happening in my these folders I need to make sure I give it a command to track all of this and maybe maybe for some reason I want to track git one and uh git 2 and not the git three there's also a possibility on that so that's exactly what we're going to study in the notes part so let me go through with this so first of all let me go ahead and walk you through with these all notes that we have and this will help us to keep a track of all the things first of all uh let's assume and understand this major difference that git is a software it is just a software and the GitHub is a service or a service provider and they are very different when initially you get started into the software Journey it is okay to assume that they are the same uh but eventually you'll realize that there are many other service providers like G so whatever do through the git and you want to keep an online version of it save somewhere in the cloud that's what the GitHub is used for and there are other services as well like there's a bit bucket which is pretty popular and there are tons of others as well which are not that popular but they exist another thing what does the git actually does what's the whole role what's the point of it I all I always say that assume that this is something like a video game in the video game you cannot clear the level on just one go you need the checkpoint that hey I'm safe till now here so if I I restart the game I want to be here on this point this is exactly ha this exactly happens in the Version Control System it keeps the track of the file and the changes of that so whatever the changes you have made uh it marks a checkpoint there and if anything goes wrong you can just go back there not only that that's also the that obviously is the priority of the software but it also helps to work in collaborative environment maybe there are 100 people working on a software maybe two people for this example uh we can actually go ahead and work in collaborative environment we're going to see that demo as well here is my learning path that I recommend everyone to who's who want to learn the G is get the basics first you cannot just Deep dive into this I see a lot of people who just look at the four or five commands that are available on the GitHub while uploading the files and never ever does the Deep dive in the git my recommendation is get the basics first and then use it in your daily life whatever you're doing whatever the code you're writing just use it daily and then face the problem this course will give you a very solid foundation but you have to face your own problems and solve those problems via chat GPT or the stack Overflow however you do that that's the best way of learning the gate use it daily face the problem now I have covered a lot more than just the basics in this course uh which is required for you and that's why this note exist uh but again you don't have to worry too much and obviously you'll be facing some of the troubles which are outside of the course curriculum so that's that's okay okay moving on first of all we need to understand some of the terminologies to go and dive deep into the git ecosystem the first terminology is known as repo and it's a short form for repository or we can uh un formally call this one as just a folder so yeah that's it a folder which contains a lot of software files is known as repository and in the world of git we call it as repo repo is nothing it's a git on system uh versus tracking the repo uh so there's a difference between having just the folder and some folder which are being tracked by the git so the very first command that we are introducing here then we'll come back on the git repo and not tracked files and all of that the First Command that we're going to learn is the git Das Dash version and there's a small thing about this command as well that I would like to walk you through so if I go ahead and run this command that is git you can run the- v as well or you can run the dh- version as well version and if I go ahead and hit and enter here you can see that my version is 2.39 do1 and if you see the online version of the git which is available is 2.44 now what you need to understand is git is a very very reliable software it doesn't ship out every next update on every next Monday but whatever the version you have anything above let's just say 2.1 or something you are absolutely fine this software has never shipped the braking changes and I don't think so it will do in the future as well very liable very uh Pleasant software to work on with this one so the First Command that we have studied is all just about the version so this is what we get as the version system all right moving further down now here's an interesting diagram that we all need to track so this is our major root folder and in this folder we have created multiple folders consider this as git 1 consider this as git 2 and consider this as git 3 so as I've just mentioned the software is installed in a system doesn't means it's tracking everything you need to mention it that this is my git repo this is my git repo once you mention this and initialize your git in that folder that folder is particularly getting tracked and the tracking of this folder can be totally independent from this folder and also if you haven't mentioned that this folder should not be tracked that's it it's never going to be tracked your software is not going to be uh interfering in that one so this is the most important part onto this one now uh let's go ahead and run and initialize couple of folders so we will learn that how we can make this entire source code or the folder as trackable and we'll also find the status of this entire folder you want to track everything in your in your computer so we're going to go ahead and learn about this and then we'll come back onto these notes and talk about this uh hidden folder that we do have here uh we'll just work on with this one so let's go back onto this command line and as I can see if I go ahead and do a quick LS I have G one git 2 and git 3 let's just say I want to track git 1 and git 2 and not the git 3 first and foremost is you can always check what's the status of the G now I don't recommend to just initialize it outside where you don't want to track things go ahead and initialize the git only where you want to track the things so I can run the command like G status here as well so G status and it will surely give me that hey fatle not a git repository that's a good thing it's not tracking the things here and that's exactly what I want if I go ahead and run the ls here now let's go ahead and learn that how we can track a particular folder so that our software is activated in that folder let's go into the git one so let's go ahead into the git one folder I'm currently into that there is nothing inside it and I can do an ls- LA to see all the hidden folders as well and as you can see there is nothing inside it now first of all let's check it's always a good habit make it your habit is to run the git status this is a command which you should run often so go ahead and make this in habit it's okay now the First Command that we're going to learn about is initialize the git software the moment you do get in it which is a short command for initialization just hit the enter and now it will give you this kind of a response that hey uh using the master name for the initial branch and we'll learn about the concept of branching and all these things in a matter a little bit later but right now we can see it gave us some of the output now the fun part is if I go ahead and check the get status again now it gives me different messages it says that hey uh get status on Master branch no commit yet and nothing to commit that's okay we'll learned about these terminologies little bit later but one thing is sure that it's not giving me those error message and this particular folder is now being tracked by the git and if I go a little bit back and do a quick LS I can now say that the git one is a folder which is being tracked by the git software and these two softwares no they are not getting tracked at all let's go ahead and move on further into this that how this actually happened the whole thing is git status is to check the status of the git software and the git in it is uh by the way this is always being run as one time per project that's why I say I love these notes because it helps me to keep in track and all the things which I want to share the inner details they never get missed out so the G init command you always run only one time in a project once the git folder is there and the initialization happens you don't do again you can keep on adding deleting removing files of your software whatever you're doing keep on doing that but you don't do get initialize again what get initialize does is it creates a dotg folder since the folder starts with the dot it is hidden but it's actually there and it a hidden folder to keep track of all your your files and folders and subfolders and Sub sub subfolders so you can go pretty uh deep into that now when we do uh simply go into the git one we do an LS we don't see it but if I go ahead and do a simple ls- la which is to show the hidden folders we can see that this folder now exist that's an interesting folder and this folder requires a lot of theoretical knowledge to go into the depth of it why don't we start just here let's go into a dogit and go up here to a quick LS and yep there's so much in here there's a head folder there's a hooks there's a refs there's a config info description object and what you'll notice that these folders and all these structures they grew they are going to grow up as we bring more files into this folder but you never ever yep never ever go into this folder and do any changes manually if you do that uh risk is on you the whole the that you are going to create it's totally on you so what we're going to do just to give you a brief idea I can just go ahead and uh click on this and I can command click on this and I can open this folder uh just up here so this is just a file I'm going to uh I'll just open this refs here so all right so this refs and this opens up the refs so you can see there's a head there's a tags yes we going to discuss about the heads right now there's nothing inside it there's nothing inside the tags but yes these are actual folders which actually keeps the track of now right now I don't want to make any mess into this one so what I'm going to do is I'm going to go out of this one and do a quick LS nothing is there that's what we have as of now okay uh now this is looking good let's go ahead and understand a couple of working mechanism of the git then we're going to create a couple of files into this folders onto this one we'll even open up our uh VSS code and we'll start with that but first let's go ahead and understand the entire workflow and once we are going to do the practical of the workflow you'll understand it a little bit better so you will also hear quite a lot about these commit statements the commit statements are almost exactly like the checkpoints which happens in any video game that you have played in your uh childhood time or even if you still do play just like I so commit is something which is known as checkpoint so in the world of software we love to call them with different and unique name so we call this as a comit but if you call this as a checkpoint inside yourself that's okay that's going to be fine the whole idea behind uh things is uh we write something into our directory uh we add that and we commit that so there is couple of there are couple of more commands before you actually do the comments you cannot just go ahead and write the comment directly so this is where I have added this small diagram on the right side which helps us to understand that how the workflow of a basic very simple git actually works and we'll do this one as well in the next video as well so the first is we have to make a working directory the point of making a working directory is simply we have git initialized there we do have that folder now after that we have to run a command of git ad and this is not a complete Command we have to mention the file name here or you can use a shortcut of dot to add everything we'll work through with that and that actually brings everything into the staging area this means this is not yet committed that means yeah this checkpoint this checkpoint is not yet made but this is known as something as staging area that means hey I'm ready to commit some of the files then you simply go ahead and run the commit command which is exactly this one we are ready to make a checkpoint once you do the git commit command then the repo is now onto a checking stage now a lot of people why they get confused with the git and GitHub because once the repo is created it is kind of a very common that you push the entire thing uh the whole thing that you have made along with the checkpoints and the source code you want to push it onto some of the cloud provider or Cloud git provider which is one of the GitHub so that's where exactly the git push command Works through we will not be doing the push command yet we'll want to understand the flow till here so we I have already created a working directory now we want to add those files and want to bring them onto the staging area we want to discuss what the staging area is and then we want to learn about the commit that how do we actually properly make a commit and move it here so this is our goal how we go with that so in the next video we'll go through with this staging area that how it works but before that we need to do some practical as well so that we're going to do in the second part of the video itself so I hope uh this entire thing was pretty useful pretty fun entertaining as well let's go ahead and catch up in the next video and go through with the staging Pia part all right hey there everyone my name is Ates and welcome back to the git series and welcome to the third part of it or the third video so in this video we're going to be again going back we'll do some of the practicals we'll go some of the behind the scene again one more time this one is going to be a little bit more of a practical tiny bit Theory and we're going to have some fun so let me share the screen first and and uh let me walk you through that what we're going to do in this video so the whole idea is to understand this part of the system first because obviously we will be going into the git push and GitHub and all these things later on but first of all it is important for us that we understand this part of the thing this is pretty nice actually so what we're going to do is we're going to create a working directory uh we're going to go ahead and work on the git ad command we'll go through the little bit details of it we'll see what this staging area is and then we we're going to walk through with the commit and we'll see how a repo or the repository or the folder looks like and then we're going to have a lot more discussion about the comits or how this is being done in order to walk through with this again we are still here and if you just go ahead and look into uh the PWD command present working directory we are in the git one and at this point we can just go ahead and check out the git status this is the first command that you should always and always run in every folder to check out whether this is already initialized with the git or we need to do some initialization once you do this if you see something like this on Branch Master uh one side note you will always and always be on some or the other branch that branch is called as Master main checkout feature whatever the name but you'll always be on some of the branch in this case case we are on the master Branch there's a little bit history involved with that as well I'll walk you through with that uh but we are on this one now I've opened this folder in the vs code as you can see on the top this is git one so this exact folder is opened up here so that we can work on and see the visualization of this now also I do recommend you to install one plugin which is known as git lens and what this folder is going to do is it will allow you to have uh this small icon at the top and once you click on this this will give you some of the graphs right now we don't have this one uh we don't have any comment or anything that's why it's giving us error that's okay that's expected uh but it's good it's good to have this uh simple plugin again I repeated it get lens pretty easy okay now let's see what we're going to do here uh first and foremost we're going to create a couple of files and folders here so let's just go ahead and use touch and what we're going to do is uh let's just call this one as test one let's go with the txt plain and old simple and we're going to also go ahead and say Test 2 of course txt we'll go through with HTML files later on these are also fun uh but we're going to go ahead and have these files the moment I have these files now you can see these two files are here if you want to see the visual aspect yes these two files are here as well uh so go ahead and click them I prefer the terminal part now let's go ahead and see what does the git status says now okay so the git status is giving us different results now it is giving us untagged files and nothing to be committed so what it's saying is basically that hey I'm initialized in this repository but there are some of the files which are not in my tracking Zone yet so if you make any changes or anything in these files I'm not unaware of it and I'm not also keeping track of them they are out of my tracking Zone as of now so where we are right now so uh the whole idea behind this entire thing is that whole thing is whenever you build any software you write some code you add that code into the git track in zone and then you make it a commit so what we have done so far is we have just a working directory in which we have created some of the files and that's it we are we have done nothing else now the next step here according to our flow is to use the command git add git add command uh does nothing magical it just keeps everything under the tracked Zone let's just say for some reason I want the test one to be tracked test two I'm still working on it I'm not yet ready to make it trackable yet so what we're going to do is we're going to run the command get add and you will constantly see that a lot of people just add the dot here and that's it uh this is if this is intentional that's great but a lot of time this is not intentional the whole idea behind ad is to move into the staging area and this is where you should only name the file which you are interested in tracking and by the way you can add multiple files just by putting up a space but in this case I just want to track one file I'm not interested in tracking all the files let's see what happens when I go ahead and hit and enter now nothing magic but again our magical command which is git status just go ahead and run this and now we see the message to be little bit different let's go ahead and work through with this it says you are on still on Branch Master okay that's good now changes to be committed that means I'm tracking one file which is new file which is test one and there's also still one untracked file which I'm not tracking on this so at this point just by adding this command that means you are on the staging area staging area is an intermediate Zone before you make any commit so it's almost like uh a pre-screen before you save your game sometimes it happens that do you really want to save the game press yes yes this is exactly that area you can stage the file you can unstage the file as well by the way you might have seen the commands here that yes uh you can do the unstage as well uh get rm-- cast and then the file name uh you can unstage them we will talk about them later on but usually nobody UNT trcks them but it's it's possible so right now we are in the position that we are in the staging area all right we got it we are on the screen where we can hit the save button or we can say no button what's the next hit the next command is to use is the get commit okay repeating again working directory added some file asked that you track this file now we are in the staging area now we need to do the commit now the commit command in itself is a little bit tricky to understand in order to do so I can just go ahead and simply say hey I'm ready to commit so I can just go ahead and hit the commit now the problem with the commit command is that uh I'll walk you through in that in the next one that this can be little bit tricky to work on with so always it is recommended that you press- m to give a message commit needs a message 100% of the time they need some message that hey why are you committing this file what this zone is or what this file does and even there's a debate what and how you should write these commit message we'll definitely go with that so in this case I'm going to go ahead and say U add file one that's it that's my command to the codebase that hey do this one okay once I do this it does some of the stuff and it says master root blah blah stuff one file changed zero insertion zero deletion and all these stuff so where we are right now in the in the diagram perspective we've gone through with this command and we learned that just running alone get commit is not enough we need to run git commit DM to give a message and then we have to provide a oneliner message we'll discuss about them but definitely we are in this repo stage right now so if you go ahead and work on with this so if you go ahead and check out uh git status again so if I run the git status again it says you know what there is only one file which I'm not which I'm worried about which is test two because test one hey that's already in the repo that has gone into the repo Zone that means everything is being tracked and everything is updated in that file nothing is changed from last I checked onto it uh that's nice now let's do this exercise one more time but with little bit error messages so that we can see what happens when things goes wrong by the way now if you have installed the git lens it will give you some of the options that hey you have created something here so this is a single line of you can say timeline that has gone and it gives me all these things author messages it will not give this exact same thing to you as of now because yes right now you are not going to be getting all these a nice author name a comit you will get but this author name is definitely going to bother you I'll show you why you are getting these error messages why I'm not getting them so yes you are in trouble already but these are the problems we really want to face to understand what goes wrong and what is all the things goes on behind the scene onto that all right so first of all let's go ahead and do the same thing again but with the test two file so the first step is simply go ahead and what we want to do is add so let's go ahead and add and this time I want to add test two file all right that looks good that has been done in the past as well and we can use the shortcut dot here as well because there's just one file to track I go ahead and hit that now the next step is to obviously now I'm in staging area you can just verify that by git status yes I'm in the staging area the next step is to commit it but this time instead of running uh the dhm I'll just go ahead and remove this and see what happens when I don't do anything like this so if I go ahead and run get commit and I hit enter oh it opens up VSS code for me but it doesn't open VSS code for you why this is happening I can write my message here I can just go ahead and say uh my second file or add second file to codebase I can just go ahead and save this and I can just simply close this file and I can go back and you can see it does work for me but in your case it might have opened up something in the terminal itself Why didn't it open it up for me what I what did I change in there that's exactly you want to learn because by default whenever you make any commit message it opens up whim and that's a little bit scary of a code editor by the way in case you are stuck with it press Escape once then the colon and then the Q you will be quit with that in case it doesn't quit it then simply press q and then the clat sign it will forcefully quit that out uh but yes nobody wants to get stuck with the viim especially when you are getting started you are a beginner uh so yes we'll discuss all these things about okay let's move back so we have done all of this so we can go ahead and see that okay uh we can just remove this and start it again we can see that the second file add to the code base so there are two commits now which I have done okay good start Good Start let's go ahead and talk about this uh now it's time that we discuss what happened behind the scene as well as why did it gave you an error of username as well as why it didn't gave it to me why did it open up the code editor as Vim for you not for me so these are the important questions we need to discuss uh first of all a little stage area that we have discussed so whenever we do a g initialization that's the start of our software that start keep track of it then simply go ahead and create files whatever the file syntax and everything are there you can just use files like get add file one and file two or optionally you can use get add dot dot simply means here that add everything that I have no matter what sensitive files are not sensitive files just add everything then when we simply go ahead and check the git status it gave me a status report that what files are being under the tracking Zone what files are untracked based on that we learned about the git commit message and we saw that the g-m is really important to provide a message most of the programmers and the coders you'll find that they give the message directly within the command line they don't wait for the code Editor to open whether that's a Vim or the VSS code so say simply so say so they simply get the message of dhm and provide a good message there's a big debate about the message as well which we're going to talk about this and then the git status I highly highly recommend that whoever is learning repeat this two three times create more files and do this flow it will be super super important for you the next command that we're going to go through is git log and we are going to go through quite in depth of it but right now let's just see what happens when we go ahead logs are pretty important for software Developers so we're going to go ahead and say get log and please ignore the dash dash online so no we are not going to be making this yet I'll show you the demo of that one as well so when I do a git log uh notice here it gives me so much of the details it gives me the commit ID so yes we can notice that each commit that I made uh we saw that programmatically and the visual part that it has a commit ID so if I go ahead and move this a little bit here and this one also here and this one again here we can see there's a commit ID but on the GUI you are going to notice that it gives me a shorter ID but on the other hand here is the big ID but notice here something interesting that this is 4 c8a something and here also it is 4 c8a so only a few initial letters usually six or eight letters are enough to make the git unique for your repository but hey nothing is stopping you from referencing and checking the whole one it also gives us some details that hey this is the user who actually made this commit and and this is the email ID of this user this is my public email ID I don't use it for the professional use and also it gives me the date and all these things and the commit message that I made so all these details are there but the bigger question is how did it came to know about that my name is this and this is my email ID it's simply because there is a config file or also known as configuration file which in which all these information needs to be saved first so that we can make all these commits and messages so we're going to do that in a minute but there there is also one more command that you just saw that there is also a command dash dash online and that's why I love this command line editor it gives me so much of the details that I can just run this and this times yes I get exactly the same but it's shorter and it's in one line it just gives me the message which is the unique sha or you can say just unique letters which makes my commit unique and it gives me the unique message and yes we're going to study about the Headmaster a little bit later but yes this is all what we got all right so let's move up here and we're going to talk about this uh we're going to talk about the config files and all these but first of all let's talk about the commit message as well on the internet there's a big debate about it and everybody has their own opinion I'm going to tell you the opinion which the official Founders and official website actually mentions and I also follow that so here it is so git actually follows a principle of atomic commits that simply means that one commit does the one job it's not like you do thousand different things and then make a commit uh you do often commits and you do one task at a time with the commits that's the whole idea behind atomicity or Atomic commits one thing at a time so here it is keep commits keep commits Centric to one feature one component or one fix if you're fixing bugs uh maybe there's are 10 bugs you're fixing so one commit one bug that's usually the idea behind all the major mnc's where you'll be working very soon hopefully so focus on one thing that's the whole idea now there's a big debate about when we write the commit message how do you want to write the commit message I can write U added one file to the codebase or I can simply say add one file to codebase and there's a big debate about this one as well that whether to use a present or the past commit message now it totally depends on uh how you want to go with that the official website or the official recommendation is simply uh use the present tense but imperative that means simple idea is give order to your codebase hey codebase do this hey codebase add this file hey codebase add this changes to my file hey codebase add a function to connect to database so that's the whole idea give order to your code base uh I'm not super happy with this style it looks too aggressive but hey I'm not making the rule I simply don't care how much your messages you're giving or all these things details but the whole idea is that yes you have to you are supposed to give command to your code base now one more thing that we're going to do in the next video is understand about this one so what this whole thing is that uh how does the git commited all these uh things works in the next video we're going to work with the git config command and we're going to see that how it came to know about me and my username which I've used as well as uh how it came to know about my email ID and what is this configuration file let's go ahead move on to the next video and talk about the configuration files hey there everyone a here back again with another video and welcome to the get Series so we are continuing our git series hope you're enjoying it in this video we're going to see a little bit more towards what happens with the git configuration file how does the git comes to know about my name my email ID and the default code Editor to open up whenever we want to write something apart from this we're going to study about uh one very important file known as get ignore so that we can ignore some of the files which are sensitive and we don't want to push them everywhere uh files like which holds uh API Keys which are very sensitive or maybe some passwords or something similar we can actually keep them totally separate so that we don't have to mention about hey don't track this file don't track this file again and again and we can work with that we'll study a little bit about the git log documentation and we're going to see bit about how the hashing are done what folders are there it's a little bit it looks like a little bit lot but it's not there these are just the concept you'll breee through them no worries at all so first let me share the screen with you and let's go with this the first idea is to figure out that how does uh get came to know about my uh name my email and all these details about this and this will be very helpful for you to know that how this actually goes on in order to first uh get about this uh first of all let me go through the notes and work with that so first let's assume uh let's understand what is there to study in this one uh the first thing that we're going to study about is this command and this command is not just Al lone one uh there are a couple of others as well the command is really simple it says get config fig and then there are two ways of how you can configure the configuration file one is globally that means U it's systemwide anytime you make any git repository or something this is going to be interacted with the global file but there is also a case that you can keep your configuration files local to that particular repository as well yes that's the case as well but usually what I've seen is anybody who is working with the git they like to keep everything as a global especially the name and email and we'll see that how we can can actually configure the editor and which is the code in my case vs code uh that's the command line name for it the code and then we're going to see about these uh changes as well first uh let's go ahead and see that how the documentation looks like for this config and we'll come back onto this one so this is the documentation of the config uh not really the best or easiest one but it's easy to find you can just click on the reference manual and this is where it is the config so just click on this and this is how it looks like uh get config get and set repositories or Global options we'll be focusing majorly on the global option but as you can see uh yep there there is no shortage of these things and it can go really really complex we have so many options and if you look at the scroll bar yes you'll be scared a little that oh my goodness do I have to learn all of this uh gratefully no uh we won't be needing all of this to work on with this uh first of all let me show you that how you can set up your username and email with will refer to this documentation it's much easier and this is from the GitHub itself and the best part is whether you choose Mac windows or Linux the options are exactly same the commands are exactly same so you can open up anytime your uh GitHub or this documentation and can write down this command get config and then we have to provide D- Global and majorly you'll be setting two things user.name and then user. email these are the two options that you have to set so that get whenever makes any commit or any push knows about your name optionally if you provide the email as well that is also a best option and my recommendation is to provide everything inside the double codes because usually we have first name last name maybe a middle name so git really doesn't know that when to end these things if you have just one word a letter that you want to use then that's fine uh but usually we have spaces so whenever there's a space in it uh it's recommended that you use like this let's go ahead and learn about these commands actually just show you that how you can write this command and where does the git actually write this command that's the most important so the commands are pretty simple you can just go ahead and say git config and the options are pretty simple Global and then you can just go ahead and say I want to use user the first option isame so you can just go ahead and write your name whatever your name is let's just say your name ises so you can just go ahead and use that I'm not going to run this command because my username is already set once you're done with this command then go ahead and use another command which is user. email Emil and in this you obviously have to provide your email so oops let's go here and we can just remove this and use your email so whatever your email is uh just go ahead and provide that for example let just say I have this one just go ahead and provide your email now this actually brings us to the option that yes we can go ahead and provide exactly same commands as you can see here user.name user. email now another command that we are going to work through with this is this one so I want to change my code editor so this is the command that you should always remember the problem with the default is since git is Linux friendly first it usually opens up the Wim which is not so cool editor for the beginners to get started it has its own learning curve so I recommend everybody to just go ahead and change it to as a default code Editor to the code or vs code now there is a catch with this one as well so let me walk you through with that first if you go ahead and open up your vs code uh sometimes it is possible that while installing the vs code your terminal might not be aware of this command so all you have to do is press command shift p or if you're on Windows control shift p and it opens up the panel here and just go ahead and write code here uh just when you write the code it will show you a command which says install code command in path what this is going to do is it's going to make sure that your computer is aware about a a command which is in the path and installs the code there without this the whole command that we are going to about to give to the V to the git is not going to work so make sure you aware of this one all right once we done with this now let's go ahead and see the command in action that is going to help me to set and configure my code edor so this is the command core. editor and by the way there are other ways of setting the code edor you can just look at the Google on it and you can set multiple other editors maybe you want Sublime Text maybe you want something else you can go with that uh make sure you also pass an option of-- weight so that it not only just open opens up the code editor it waits there for a moment so that you can write your things and as soon as you close the file then it starts processing the work so that's the whole idea behind writing the dh- weight so once you're done with this uh that's it that's the whole thing now moving back onto the notes now that you are aware that how you can set up all these things I highly recommend that at this point of time just pause the video and go back onto your repository create one more file uh add that commit that and try to uh just push that so that's the whole idea not push but at least commit that okay now moving on uh what we saw in in just a moment ago that uh we do have this git login online we discussed about this command uh just a while ago in case you remember uh we worked on through this one so let me go ahead and remove this uh git log online on line not online uh one line it gives me the logs of the git uh in just one line so obviously you might be wondering that do I have more options onto this one absolutely you do have uh let's go ahead back into this one and just just go ahead and look for the log here it's not easy to find so I always go for uh control F find that and there we go we can see the log here and if I just go ahead and click on this there are so many options that I can work with uh just showing you a few of them uh we have options like f diff log size start there's so much of them uh let me zoom out a little bit and let's just find out the one that we are using which is one line uh there we go so this is one line option that we have let's go the first one here the second one and there we go so this is the one that we have been using but as you can see there are so many more options so this is the one that we have been using D- one line option but as you can see we have options for encoding we have options for tab expand I've never used this notes there's so many options and honestly no nobody has ever used them there are only few which are being used quite Handful in your organization or in your workflow you always go with that Allah right left branches graphs pretty formats all medium short full like there's so much of these options and uh honestly nobody's aware of this but just wanted to show you that how the documentation actually looks like for this all right moving on so let's go ahead and uh go with the notes so the next thing thing that we are going to learn about is the git ignore so as we can see that the git ignore is one very special kind of a file uh which is read by the git itself and you have to create this file so let's go ahead and create this file I'll first go ahead and check where are the things so I'm into to this test one.txt and text 2.txt now I want to create one more file and this one is going to be having a very special name which is dogit ignore and yes uh should be lowercased and it should start with a DOT this is a requirement no exception at all once you go ahead and create a dogit ignore file uh you'll see that in our code editor uh this file actually is available here and right now this file has nothing at all so what's the point of having this file now first you need to understand that whenever you have these kinds of files uh whenever you're are building any big project there will be a file known as environment variables and this file holds all the sensitive information like your API keys and if these API Keys gets leaked out anybody can misuse your system if these are AWS keys somebody can spin off machine bigger machine can lead to the bill if these keys are open API keys or open AI keys somebody can make a lot of requests and generate a good bill for the open AI so you get the point there are some sensitive information which we want to keep separate and safe for example let's just say I have one uhv file very common file to have in this and let's just say this is my mongodb URI and I'm going to go ahead and say this is my uh test URL path whatever that is I don't want this file to keep on going but right now the problem is that if I go ahead and check the git status uh notice here if I go ahead and work with the git status it says that hey there are couple of files which are untracked this vs code don't worry don't bother about it this is the vs code configuration file don't worry at all but I don't want this file to be keep tracked of it or it should go about it also this EnV file since it contains the sensitive information all the time when I go ahead and work with my directory then I have to say git ad and very carefully that hey I want to worry about this git ignore and VSS code and maybe I've created uh five different files more let's just go ahead and do that that would be super cool let's go ahead and say touch and we're going to go ahead how many files do we have uh one and two let's go ahead and say that I want to create one more test 3.txt and maybe there is one more and this is going to be test 4. txt okay now let's check the git status again if I go ahead and run the git status I have so many files that I have to monitor and at this exact point I would love to use something known as git add dot so that it adds all the file that I'm creating and when we working with something like JavaScript Frameworks there are thousands of node files sometimes this option is better choice but I cannot do this because hey there's there's some stuff going on so the point is that you can just go ahead and come into this git ignore file and mention all the files which you say that hey I don't want you to keep a track of them completely ignore them out of the git ecosystem so we can just go ahead and write EnV just like that exactly the file name if you have more folders name you can go ahead and write folder name for example there is a folder slash just go ahead and write it like that most commonly you'll see something like nodecore modules like this ignore all the files and this entire folder so it's a common thing now the moment I enter all these things into this let's check what happens when I run the git status command again now notice here in the git status and if I compare it with the above one previously it was keeping a track of EnV and now it's not keeping a track ofv I also don't want that this vs code since this is just my personal folder nobody should be keeping a track of this one so I'm going to go ahead and say I'll say uh VSS code and this entire folder I don't want this folder to be tracked up let's see what happens when I go ahead and run the git status again now it's keeping a track of git ignore which obviously we want to push and it's also keeping a track of all these new files that we have so pretty good let's go ahead and try to run this thing again and you can do this again with me because you have already set your username and your email now you'll be able to follow me along so let's go ahead and say get add and I want to add all these files so let's go ahead and use a shortcut git ad there we go let's check the git status what happens now so now it's keeping a track of all these files they are in the staging phase that's our intermediatory phase we can unstage we don't want to let's go ahead and commit this now let's go ahead and run the git commit and once I do the git commit no dasm option if I just hit enter now now it's it is going to open up this vs code editor and the commit file notice here the file is commit unor edit MSG keep this note here I'm going to show you where this file actually exist this is exactly where I want to be and this is exactly the file which you might have opened up if you accidentally have run the command without configuring your code editor so that's that's a mistake uh be aware of this now I can write this message here and again don't worry about these hash these are all comments they never go inside the commit message so you can ignore them safely if you wish you can delete them but sorry but let's just keep that that was unintentional but happens when you do record videos anyways uh let's go ahead and work with this now let let's go ahead and write a message for this and this is my third commit if I'm not wrong and I'm going to say add third and fourth file and again we are following the same uh convention that we do give command to the codebase hey do hey codebase do this stuff once I save this and close this you will notice in this uh we can simply uh no don't show any notification but here we can see the commit is performed uh nicely and let's go ahead and do the git log and we can see add third and fourth whatever that is third and fourth file or whatever that is but we can see we are able to successfully do all of this but there is one more thing that we need to worry about and not just one actually couple of things which probably might be bothering you probably not be bothering you but I'll give you these bothering question first and foremost uh the question is I know that there is a g ignore file but how will I know in thousands and thousands of files in my project that what should I write in this G ignore and thankfully you can just do a Google uh for this keyword which says get ignore generator and yes folks of the internet are always great and they have given us so many of these generators all of them does exactly the same let's choose the second one first one whichever you like feel free to choose them let's just say you are working on node project just go ahead and click on the Node and just simply say create and it will give you a pre-generated template which simply gives you that commonly ignored files and you're going to see that yes there's a EnV here which are being ignored so most of them are pretty good and it's just not about node it's just I work mostly on that you can just go ahead and look for the Django files if you're working in that ecosystem so yes uh these generators are available even there are vs code plugins for these generator so anytime you're working with this it's a good idea that you come up here and just look for whatever you are working whatever you're coding and again by the way I can show you more as well there's the first one uh by topal and you can see that hey if I go ahead they all give the same file they're all being same so you can see this is how you can just copy and paste this one so yes don't worry about uh having the git ignore file it's totally fine and totally okay uh to copy paste the things here all right another thing which might be might not be bothering you is we studied about this one thing which is this one git config and if we are providing the things like user.name user. email there is 100% 100% case that this is getting stored in some or the other file where is that file I want to see that file maybe you don't want to but I want to see that file so that I can know where the things are actually going and of course so we're going to do that for this first of all we need to hit the root of the Mac or if you're in Linux again the same command all you have to do is hit the CD this is the home directory by the way you can check this out this is my home directory of the entire Pro of the Entire Computer in the windows it's usually the C drive or the users drive wherever you are you can figure that out and in here what we can do is we can just run the cat command onto a very special file known as Dot and it's known as git config this is the global configuration file if I go ahead and hit enter onto this one now you can see that it gives me name and it gives me email it gives me the signin key which obviously I'm going to blur out this is my signin key which I use to sign in into the GitHub account but yeah this is how it looks like and also you might have noticed that it says editor is code-- we so by the way it has a lot of blocks like the user block the commit block the gpg block and there can be other blocks as well which can work through with that I'm going to go ahead and hide this because I don't want you to show uh my gpg keys and all these things but yes the whole idea is that everything is stored in some file and if any time you think that I don't remember the command or something you can literally go into this file and change it there is nothing wrong with that it's totally a configuration file that's it all right so moving on a couple of things behind the scene theory that I want to share with you these are really interesting ones as well so how does the commit work now that we have seen that couple of commits actually work so if I go ahead and check out my uh git section here and the git we can see we have two three commits which are going on and we can uh work through with that by simply running the command uh git log online first of all we need to go back onto this folder let me just go into this folder and for this let's go ahead and drag and drop this I'll just go ahead and say yep that's the one I want and let's go ahead and do a quick LS get one let's go into the CD git one I love these suggestions let's try the command again which is yeah this one and we can see that these are the commits and we have no idea but somebody saying head is pointing towards master I have no idea what that is I really want to explore this let's go up here and try to see what what happens with these commit messages so in the world and the ecosystem of the git every commit is dependent on the previous commit except the first commit and that's exactly is mentioned in these notes as you can see whenever you make a commit and how does a commit is comprised of if you look at here there is a really long unique ID up here this long unique ID is uh known as the hash and hash is generated it's nothing just a long uh combination of letters and numbers uh so it's is generated uniquely by some algorithms known as shaan and couple of other algorithms as well so it is comprised of this a commit message and some information about it but what's not being shown here that the commit is always dependent on the previous commit as well because it's a it's a tracking mechanism which helps us to track what happened between the previous commit the previous checkpoint and the next checkpoint and this is exactly I've tried to present here uh in the demonstration so this is our first commit every commit will definitely get a hash but there is also an information about the parent like what is your previous commit who is your previous in the very first commit the parent pointer yes this is exactly a pointer points towards the null that hey I'm the very first commit I'm not dependent on anyone and apart from this couple of other information is also stored like uh what was the system what was the time what was the user what was the email and all these things so this is all is being captured inside the info itself whenever the second commit is made you obviously generate a hat hash but this hash is generated based on the previous hash the previous parent information and some of the chunks of the info not majorly but it's heavily dependent on the hash and the previous commit and this parent is going to be pointed towards automatically towards the previous one and this is exactly the mechanism which helps you to go back in time or in the previous checkpoint so that you can just restore the file information into the previous saved information and the third one goes exactly like this we have a hash we have a parent which will Point towards the previous one and we have the information so pretty simple stuff but what's fun is actually to found this ability to check all these hashes let me show you how we can do that now if I go into this folder what you're going to notice is I can do a LS all right that's good but what you'll notice is I can also do an ls- LA which is a command to give me a long listing and show me all the hidden files as well and what we can see now is is there is a folder known as git and Yep this is a directory yeah that's nice can I go into this directory of course there is nobody stopping you to go into this one it's your system let's go ahead and say that I want to go inside this git and if I go into this git and do in LS I can see so many of these thing one file which I've Just Seen is commit unor edit MSG the message file remember the file which we opened up while working with the commit when we didn't pass the message DM exactly that file but not only that we have some of the folders known as hooks uh objects refs index head and some of these files as well the better structure that we can understand here is doing in Long listing so that we can see some of them are files and some of them are folder so as we can see these all things are file this all thing and including the index one these are all the files but here the hooks and the info logs object these are direct Ries and what's the fun if we cannot go inside these folder so what I've done is inside the code editor I have actually opened up so that I can see all the dot files by the way you can do that pretty easily by opening up command shift p and uh if I or not just command shift B if I just go ahead and press command and comma or on the Windows control and comma you can see that this option is there which says uh files exclude file and here you can see the dot uh git is is there just go ahead and Mark an x on that just remove it and that's it you'll be able to see all of your hidden folders anyways the whole idea now is that can I go into this git folder and explore these things so if I go ahead and zoom this a tiny bit more we can see that all these are folders and some of them are commit edit messages this is exactly the file that we opens up when we write these messages we do have some of the things config the core configuration which is repository level not the global level we have the file which are descriptions we don't want to worry about that as of now it's an unnamed repository we also have this interesting thing which is head which is notice here is pointing towards the master as I mentioned in the Git You Are Always On some Branch we are right now by default the branch master and that's what this head is pointing we'll study about the head in the upcoming videos but right now this is enough index uh we don't want to go into that because that's a file we don't want to open right now it keeps everything in check but not only that you can also see that there are some other things as well most importantly the hooks this is one of the most advanced folder in the git and this is exactly if you have studied hooks in JavaScript or react or anywhere else this is exactly the same so if you want to execute some of the scripts or some of the some of the commands or some of the code which needs to execute just before the commit or just after the commit message or you want to control that the how the commit message actually goes out maybe you want to add the ticket IDs and you want to validate that whether whoever is committing the message is providing the ticket ID for solving this bug you can actually do all of this through here and a lot of companies does that and it's nothing uh these are just the samples here you can go ahead and change these samples like pre push so this is all the code that how you can write these code let me just zoom out a little so these are all the codes that how you can actually have an example hook script to verify before the push just the pre hook uh there is pre- rebase a lot of companies use rebase we'll talk about them later on it's a pretty nasty and scary command but we have Commit message if you want to control that how the commit message should look like you can write a hook for that this is a little bit out of the scope of this entire course or even any course at all uh but yes this is totally possible we do have info as well uh not going to be touching it much it's not useful for us as of now this is where we keep all the logs that what all happened in our repository if you just remove this everything is gone and again this head is not readable much as of now but some of the points we can read about like add third and fourth all the commit history actually goes into the head uh we do have some of the references as well like where the head is pointing the head is pointing towards Master as of now later on I'll show you how to change the branch and we'll come back here and we'll see that how this heads actually get changed so the software how Works internally is totally open to us and this is what I love absolutely about it so coming back on to the notes part so this is what we have studied into this particular video that how the commit message are being made and are being stored in our application that's a really fun part and I hope this actually gives you a more clarity of how the software Works internally and once you know this you get much more confidence of using the software in itself it's not really that hard in the next video we're going to be talking about the branches and what we I've been yelling around for some time about the master master master what is this master and what are these branches uh this is all what we're going to study in the next video hope you have enjoyed this video if you have enjoyed this uh do let me know in the comment section it really really motivates me to make more such videos that's it for this one let's catch up in the next one hey there everyone at here back again with another video and welcome to the git Series so we'll continue and in this video we're going to be focusing more on the git branches now this is really a fun topic and pretty awesome as well uh some of the portion of this video uh are considered as a little bit Advanced but not for us we're going to be just Bree through it we're going to flow through it and you'll be having so much fun so we'll learn about the branches we'll understand the concept behind it how it works behind the scene and you will get to know that how the collaborative environment works in the git it's pretty fun let's go ahead and get started and we'll do everything from scratch again we'll be initializing a repository we'll put some files and folders onto it and we'll start from there so what we're going to do is let me first share the screen because that's the most important part and let's go ahead and move into a new folder so that we can work on with this one so what I'll do is I'll open up my uh folder and I'll just move in here so this is where we have been working with the git one uh so far we have been working with this but now let me just go ahead and drag and drop the git 2 which was another folder uh just sitting ideal for us so I'll just drag and drop this one all right so this folder is open with us and let's start working with this first that how usually an application is designed so I'm going to go ahead and move into uh this folder here so just adjusting some stuff so let's go ahead and move on to One Directory back and if I do a quick LS I can see I'm still here I'm going to go one folder back and I'm going to see that we have git 2 this is the intentional folder where we want to go further let's go into git 2 oops and we'll go into git two there here we go and if I do a quick LS nothing inside it so obviously the first step always is to initialize the gate so this time we can see the entire workflow happening around let's go ahead and work on with so we're going to go ahead and first check the status this is always a good idea make this a habit that always check the git status although we understand that it's not a git repository but it's a good idea to have it in your flow after that we know that we always run the command git in it to initialize the repository so there we go once we initialize this and check check the git status again we see that now we actually can understand some of the mode status like it says git status is on Branch master all right what is this master and what is this Branch concept and no commits yet okay we understand this part but what is this Branch here and what is this master even if I go up here and if you just shrink this uh little bit here uh just like that you can see on the bottom part of it it says Master here uh so this is pretty nice and interesting we would love to get to know more about it that how this actually works so right now we can see we have nothing inside it let's go ahead and create a couple of files and folders so let's go ahead and say Hey I want to create one file and let's just go ahead and call this one as index.html I'm pretty sure you are aware of what HTML is and even if not it's just a basic text file you can create that as well but I think you are quite familiar with the HTML workflow it's a pretty basic one so we're going to just go ahead and create this one and let's see what happens if I go ahead and check the status get status and it says hey there's one file which I'm not tracking cool uh let's go ahead and add this file we know how to do this we can just go ahead and use a DOT or we can just go ahead and use index.html let's add this now we obviously know this is in the staging area we have already studied and discussed this if I go ahead and check the G status uh with this one we know that this is in the staging area what do we do after the staging area we just Commit This one we're going to go ahead and use the commit we obviously don't want to open up the VSS code so directly we'll be giving up uh- M as an option to provide a message and I'll just say add index file that's it my command I go ahead and enter this now my file is there if I go back up here I can see the index file is there I'm on the master one uh that's good but I'm not able to see the git folder and all the things that are happening so let's go ahead and use a command comma and just scroll a little bit where we see all of this so that you can see freshly how this actually works and now you can see there's a dogit folder which is maed as hey you can just go ahead and hide it completely I'll just go ahead and cross it off and that's it once I cross it off I can see my git folder which I'm pretty interested in and I can just open this up and have a discussion on this so now that you saw that firsthand all right so far we have seen all this thing but now here is the new command I can just go ahead and run a command and that is get Branch I'm not going to do anything outside of it no dasm nothing like that we'll just go ahead and learn about the git Branch what happens with this if I go ahead and hit enter it says an estri a pointer which is pointing towards the master all right pretty interesting how do we do with that what's this branch and let's go ahead and study with that about all of this through the notes these are the best way to understand this so branches what are these branches in the git folder uh branches you can just simply understand like an El alternative timeline now I don't know if you have watched the doctor strange recently or not pretty good movie but it's like a timeline and every single coder who is contributing to the same code base can be on its own timeline without affecting each other's timeline so for example there is always and always one branch on which you will be now by default git is a pretty old software that's why it always by default creates a master as a branch so this green one you can consider this as a master branch and all these nodes are the checkpoints or the commits that you have made now fun thing about this master branch is these days nobody likes to call it as Master there's some controversy around it we W want to go we don't want to go into that so it's pretty obvious that you will be asked to rename your branch as main again call it main Master Superman doesn't really matter just a branch name so this is our straightforward timeline and this is where we are sitting right now and that's why our pointer said that you are on the master branch pretty accurate now how do we create the alternative timeline and how can we work with that that's an interesting question so that's exactly what we'll be going and then we'll come back and talk about the head we will definitely keep an eye on where the head is pointing right now and then we'll come back first let's create a couple of branches uh walk through with them do some commits do some exercise with that that would be pretty fun let's go back right now it just says that you are on the master Branch okay and if I check the G status obviously there is nothing much it's just nothing so in the index file I'm going to go ahead and use an exclamatory sign and hit the tab it gives me a default so I'll just just go ahead and say uh get learning I'm just designing a web page not designing basically I'm just writing some text into this one so looks good as a project all right looks good now this is usually how I write the code now if I go ahead and check the git status and git status and it says there's one file which is modified I'm not uh having a history of it or I haven't made a checkpoint of this so would you like to make a checkpoint of course I would like to make a checkpoint so I'll just go ahead and say hey I would love to add the index.html okay and then I would like to add a commit on them by the way you can just work with the commit directly as well commit and add can be done in one command as well I'll walk you through with that one as well uh nothing of a big deal but I usually prefer twostep commit so there we go we have- M as an option and add index file and I'll just say update code for index file looks pretty good and I'm going to just go ahead and make a commit there we go now we are done pretty good exercise and we can see all the things are going but what's interesting is even if still I check what is git branch and there we go it still says pointing towards master and if I go ahead open up this git folder first of all notice this head I hope you can see that that's visible nicely notice here there's a head here and if I just click on this head it says ref head Master time to zoom out a little there we go uh you can see that it says head ref head Master we'll see that we'll check this file again one more time once we create more branches and also inside the ref you'll see the heads and if I open this up there's something known as Master what's inside that doesn't really matter it's just a unique code the Sha value doesn't really matter but it says Master now step one how do we create more branches is that's that's the most important thing there are a couple of ways actually how you create multiple branches and all of them are correct there is nothing absolutely wrong with that let's go ahead and start with the basic one so I'm going to go ahead and say get branch and let's just say there is another coder in my team who is working on the navigation bar and uh we'll be working on navigation bar so I'm going to go ahead and say Navar is the name of the branch now how do you pick up the branch name now that's totally internal up to the company you can call this as navbar you can call this as bug fix you can call this as a feature whatever you like you can name it whatever you like I'm going to go ahead and say git Branch Navar I hit enter and now let's check when I run the git Branch command it says okay my pointer is pointing towards the master but there is another branch that I can move on to and it's known as nav dashar if I go up here uh notice here the ref still head says Master but now we have another folder into it which says nav bar so yes head can be on the master or it can be on the nav bar but here the head is still pointing towards the master that is still not being changed because our pointer is pointing towards the master okay how do I move onto a different branch again there are multiple ways of doing so we'll be using the the most easiest one which is the git uh checkout and we'll be calling that I want to go to Navar the moment I say get checkout uh Navar I go ahead and hit enter now it's switched to Navar now what changes does it actually make first of all I would love to see the branch okay the pointer of course color is not a good idea in the terminal to check out that hey it's green now uh the most important thing is this pointer this pointer is now pointing oops the pointer is now pointing towards the Navar that's good let's see what happens here in the head uh the Navar is here uh the master is here both of them are here uh both of them actually are pointing towards the same thing because we have done anything in that other Branch but if I go ahead and check the head now the head is actually pointing towards the Navar so here I'm showing you the behind the scene details of how the git actually works internally on the command line and how these outputs actually comes in okay uh this looks good but technically I hope you can see that what is happening and I think our git uh get this one is going to help us to understand the things now we can see although we have created the branch but you can can see the navbar is here the master is here they both are pointing to the same location so let me tell you what is happening right now through the notes I think that would be much more easier to understand so this right now is our commit then we made one more commit and then we created one more Branch although we have created a branch but the code has never changed there is nothing which we have done here so even though there is an alternative timeline that is going on but that is also pointing actually to the same code itself so we haven't done nothing whether you call this Branch as navbar or Master they basically are doing exactly the same thing the code is exactly same so right now all of us are sitting at this position uh so we need to move forward in the time so we need to do some work inside uh this uh branch which is Master we need to also work a little bit on the nav bar so that we can see what differences they do make and uh does they affect each other's code something like that all right so currently we are on the nav bar so what we're going to do is now we the nav bar so we're going to go ahead and create a new file and since this guy is working on a nav bar let's go ahead and say that hey you create a nav bar HTML and we're going to go with that now we have a navb bar. HTML so I'm going to go ahead and say hey navbar this Navar requires its own code so I'm going to go ahead and simply have a nav and I'm going to add some bullet points into this so unordered list inside that list have some of the list items and we'll just have three of them uh basically I'm just writing nav bar here so what do we have home we will have about us and we'll have contact us pretty classic uh feel free to write any text inside it that's also exactly the same now that we have some of the text we have worked on our navigation bar maybe that's all is required it could be as complex as code as you can imagine but this is what I am having and currently where I am I'm on the nav bar let's go ahead and check out the git status if I go ahead and check this there is one nav bar which is untracked remember reminding it again I'm on the Navar Branch I'm going to go ahead and say hey let's just go ahead and add this uh this time this file name is navb bar. HTML added this and let's go ahead and Commit This so I'm going to go ahead and say um let's go ahead and add this commit message add navbar to codebase pretty good okay uh this is what we have done so far that we have added a Navar all right now let's see what happens and let's see what the branch situation is in this case it will be much much helpful to check out the git lens the plugin that I have mentioned earlier in the class now notice here the Navar is here the master is here so Navar has moved a little bit ahead and master is still at the same position all right let's go ahead and switch the branch and see what happens so how do I switch the branch again pretty easy you can just go ahead and do a good uh get checkout and instead of the nav bar we're going to go ahead and say hey let's go on to the master Master Branch the moment I switch to the master Branch look what happens to my code base the file which I made navbar is completely gone yep it's completely gone why is it gone simple reason because it was added by some another coded we haven't merged those branches he's working on his own timeline I am completely unaware of what he's doing let's just say I'm also here and I want to work on something so I'm going to go ahead and say that I'm working on the hero section of the website so I'm going to go ahead and say uh let's just go ahead and add a hero section let's add this and once I have this hero section and I should actually rename this it should be moreover rather hero section. HTML my bad and let's just go ahead and add this let's just open this file remove this remove this so how does a hero section look like we'll just go ahead and add a section uh we'll add an H1 onto this one and let's just add lurm 10 words there seems good like a hero section and what else maybe a paragraph with some lurm words of 20 yeah there we go so we have some laum but this is our hero section obviously what do you want to do now you want to commit this code let's just go ahead and say get add and we have this hero section. HTML added this let's just go ahead and do a commit and this time we're going to say add hero section come on hero section to the code base all right pretty good now what happens to the code base all right the hero section is here but the most interesting part is how does everything looks like when we change this let's do a checkout I want to do a checkout onto the Navar the moment I do a check out on the nav bar and I can see the Navar is here but hero section is gone and if I do a check out onto the master if I go ahead and check out the master and my bad it's it's supposed to be Master although AI can actually suggest me the commands that's really nice but if I go ahead and do this now my uh okay where am I I am switched to master so obviously hero section is here but so you get the idea you get the idea that we are having a completely different timeline so right now this main branch has moved into the time and have added some of the code to the code base on on the other hand this Branch who is representing the Navar has done working with the Navar so they are completely on different timeline completely different code bases completely different file and that's why I say it is so magical to work on with this the most important thing here to actually understand one thing which is about the head now head always points to where the branch is currently at now it is not always necessary that your head is pointing towards the end of the branch usually it does but you can actually allow your head to point one back as well because it's a checkpoint just like you can restore your game into the previous checkpoint yes exactly we can do with the code bases as well but one thing you need to understand that it the head the whole idea the concept of the head cames from uh these cassets where you have a head which plays onto that if you flip the cassets uh these head is still pointing towards wherever you left it last time so this is a head if you switch to the master Branch this is obviously going to point towards here but if you switch on to another some Branch your head is obviously going to point towards that Branch it's not a pretty difficult concept to understand it's just that wherever your branch is latest that's where it's going to be pointing so let's just go ahead and try out that where our branch is so let's go ahead and learn about it get Branch currently I'm on master so where my branch is pointing towards where the head is pointing the head is obviously towards the master and not just there are multiple commits into the M Master Branch as well so it's pointing towards the latest ref that's there is so we can see that we have nothing inside the tags as of now but heads can be on the master or can on the nav bar now this master as you can see let me just walk you through with the git log this is where the git logs are pretty important and we're going to go with the one line notice here the head is pointing towards this Branch 31 AE and that's exactly the file that we can see here so it could have pointed we can forcefully ask it that hey Point onto this one I don't want to see the latest comment I want to point towards the one back comment I'll show you the commands for that but it's completely doable so you get the idea where the head is it just points towards where the updated code base is or where the intentional code base is all right that's nice now let's go ahead and switch uh this one so I'll just close this so that it doesn't mess up the things let's go ahead and uh check out another Branch so we're going to go ahead and say get checkout and instead of the master we're going to go into the nav bar there we go now if I go ahead and do the git one line again notice here it's pointing towards the nav bar and uh this one obviously is gone so now if I open this up again and I check out where the head is the head is pointing towards this one you can just go ahead and check this one it's pointing towards the nav bar and this is where right now the head is all right quite a lot of in-depth detail now uh coming back onto the part that both of them are completely unaware of this and we have learned about this so this is the flow that we have worked on with so far so we learned about the git Branch command it shows me all the possible branches are available and we can just create a new Branch by simply saying git branch and bugfix usually this is the common syntax but call it navbar footer bugfix whatever you like you can just go with that and you can also use the command git switch or you can check use the command git checkout both of them almost does exactly the same it just moves you to another Branch so feel free to use git switch or you can use git uh checkout and git log we have already seen and we have done multiple times of the switching and all these commands now there are a couple of shortcuts that you'll see quite a lot around thrown in the entire git ecosystem what you can do is you can run the command of git switch Das C and then the name of the branch it will do the two things at the same time it will create a branch and move you there so yeah that's nice you can also do exactly same with the git checkout as well git checkout when used with the option of dashb uh B for Boy Yes Dash B and you can go for dark mode pink mode whatever you like and it will just create a new branch and will move you there as well so again shortcuts you can use branch and then checkout or you can use the checkout dasb to create a new Branch as well as move it to this one and always commit before switching to another branch is usually a good advice uh you can just go ahead and give it to yourself and always go to the git folder and check out if you're in initial phase to understand the concept of the head that where the head is pointing towards now comes up the interesting part is obviously we don't want to hang around with the different branches if I have to check out the navigation bar I have to move to entirely different branch and if I want to check out the hero section I have to move into uh the main branch or the master Branch so it's not a good thing it's not a good feasible workflow so we need to learn something about merging of the branches now merging of the branches a lot of beginners are afraid of it you don't need to be I'll walk you through with that so there are two types of merging one is the fastforward merging uh in which the main branch doesn't do much you just work entirely onto a separate branch and then you merge that Branch into the main pretty easy workflow with that uh this is the one where the master Branch remains as it is we don't change anything I'll show you that workflow as well but it's much more easier to actually merge this one but what's uh critical to understand is not fastforward merge in this case your alternative branch is also working your main branch is also working and eventually at some point of time you want to pack into this one so so I want to just go ahead and uh merge these things so in order to merge uh first and foremost make sure you are on the branch uh which you don't want to merge like uh whole idea is I'm bringing something into me so I should be on that platform it's not like you're on different platform and you're moving that same platform here the ideal situation is let's just go ahead and merge this all right so this is pretty easy to work on with this let's go ahead and have a practical of this one first of all where you are so if I go ahead and check out G Branch I'm on Navar not a good idea I want to be on master so that I can bring navbar into me so I'll just go ahead and say get check out and I'll move into master all right let's check it one more time now I'm in the master Branch but the problem is that how do I merge the nav bar in the master so that I can see the Navar onto this file now we have a special situation right now that nothing is conflicting each other whatever the branch I have created that Branch guy didn't worked on the F the same file that I have worked on he worked on completely different files so that is okay that is a good situation right now in order to merge this all I have to do is just run the command get merge and the name of the branch that you want to merge in this case I have a branch that is Navar once I go ahead and hit enter it's saying waiting for your editor now this is waiting because I haven't passed any message for this one the default message that it gives me is merge Branch Navar so obviously what we're doing right now is we all are moving into the new Zone that means this Branch was trending here this Branch was tring here so obviously we have to move forward in the time we cannot go back in the time so we are moving forward and in this particular commit we are taking this whole code in here but this particular commit also needs a message a commit message to work on with and that's exactly what is happening it is giving me that hey choose a message and usually the message looks like this merge Branch Navar so we are pulling all the code of merge branch in here pretty nice I'll go ahead and I'm happy with this message so I'll just save this and close this I'll go back and no I don't need any notification and notice what happened here it says navb bar. HTML there is seven something here there's a Plus+ Plus+ plus here that means all the code that was there was the insertion code no deletion code was there one file was made changed and create mode and whatnot now I would love to check out the git logs that would be very very interesting okay so at this point everything was okay then there was this nav bar add nav bar to the code base so what happened here is all the commits that were made in this green zone so this is our Navar are also a part of now this main branch so anything that happened here is also coming in here okay so this na bar here then we worked and added the hero section to the code base that was in the main branch but now we have merged into this all of this now how does it looks like does it really look like these branches and all of that yes it looks exactly like that let me show you that even there are tools like uh git lens are going to show you this so notice here now this is exactly much much nicer to see and understand can I zoom this a little yep so notice here we were working here the commit was included the head was here then we merged out we went and we started to create a new branch which was Navar for bringing in the navigation bar in the meantime we worked on this one and there was one commit made that we wanted to work with the hero section and now we both are going in the future and are merging everything how nicely and how easily it was all done pretty nice pretty okay let's see the code base as well because that's where the interesting part is apart from the git now we have index which was already there we have the hero section which was already there and we have the nav bar as well so all the code that my friend has written or my colleague has written is now in here that is super super nice now although it's not really kind of a fun thing to do but a lot of companies does this thing is writing one more additional command and I'm going to just show you here uh it's not really fun not my favorite one but still a lot of companies has asked me to do so so I can just run a command git branch and the Dash D it's a pretty dangerous option that's why they call it as-h d uh fun stuff it is actually for deleting the branch and I want to delete the branch Navar what happens when I do this oh it deletes the Navar Branch what happens when I just go ahead and run the command get Branch now we have just one branch which is Master H interesting let's go ahead and check out this and git lens all right so git lens let me just go ahead and start this again so although in the git lens history we still have this oops my bad we all all have this once because it was previously made so we are not deleting the history of itself but now we are deleting this Branch because the branch has served its purpose it's no longer useful for us if we need we can create more branches and it works pretty fine so this is the entire part of how things are done uh can we do something more exactly same this time a little bit fast forward so that you can see things happening a little bit Fast Pace yeah so of course why not uh we know that we have just this Branch so how do we go ahead and create a new Branch we can do this this time uh using the git checkout dasb option and we want to create footer so let's go ahead and create a footer for this one and we switched into the new branch and we can just go ahead and see git branch and there we go now we are on the footer if we go back onto the code file it's exactly same uh thing which are pointing let's go ahead and create a new file let's go ahead and say this is footer. HTML go ahead and say hey this one is going to be footer there we go and nice footer um I'm running out of the words nice footer and what do usually people put 2024 copyright something like that we have done this now we want to obviously uh check out this one not check out yet uh add this one by the way we can do add and commit at the same time as well I'm not interested in that I'll just do one by one so I'll just add this one and I'll go ahead oops get commit and we'll just go ahead and use add footer section would be nice add footer section to the code base there we go we have done this uh so there is a commit now and U obviously our main branch is not aware of it let's go ahead and get check out we don't want to use dasb now I'll go move on to the master and hopefully Master is not aware of the footer whatever the work we have done Master is not aware of it but if I go ahead and check out this one uh get lens now we have another footer branch and we want to merge all the things that we have done the footer branch has done into this one so pretty simple in order to merge any branch what we can do is first uh see where we are so get branch is a nice option to run again I'm on the master I want to bring all the code from the footer let's go ahead and do that get uh merge and we're going to go ahead and bring in footer there we go since there are no conflicts uh it just merged it and uh there we go pretty nice and easy and we you can see the footer is here that's it now coming up on to the more complex stuff than this because this was all easy all easy and people are not afraid of the easy part and merging the branches is a tricky task let me show you why why it does so there are possible chances where things are not that much great things can go a little bit messy let me show you what happens when G tries to get into the conflict Zone and let me show you first what are these conflict zone so that you can understand exactly so where we are right now we are on to the master Branch so let's just say we're working on the master branch and we go ahead and check out the index and we go here and say footer added okay and what happens if somebody go ahead and push this comment nothing bad we can just go ahead and say we have to check the status first good practices we know that this is here so we can just go go ahead and say get add index so assume this is a really complex code uh we have added this we want to have a git commit and we'll just go here add footer in index file commit that pretty nice and easy now now comes the conflict part somebody did checked out the branches and somebody checked out onto the footer Branch get check out if I can write that and I'll go into the footer Branch okay now I'm in the footer branch and uh what I did here is once I checked into the footer Branch I actually went into the index file again and I see there's nothing there's nothing inside this Branch I went up here and I just simply said footer was added successfully all right so I hope you can see this is a point of conflict now we're also going to go ahead and add a commit let's go ahead and say get add index file this is the file that we want to add get add now this time we need to commit and we are going to go ahead and say something different as a commit update index file would be good message update index file file with footer code all right so we have done this now here's the interesting part we can go ahead and check out we are on the footer Branch so we can we can just go ahead and check out this first so we have added this one here I'll just close this let's check out the master branch and fun stuff here oops my bad have to write it properly Master Branch if I go into the master branch open this up footer added okay I close this I come back here and I go ahead and say get check Che out footer I go back here and I see the index file footer was added successfully this is a point of conflict and we need to discuss this how things actually happen so the whole point is so far we have been into this whole good situation whether the branch the main branch was not doing anything whole work was done on the another Branch so we just went ahead and merged all together and the timeline goes again like this this is pretty good interesting nothing bad and there is not fast forward merge which is in which the main branch is also working and uh another branch is also working but the whole point is they were working on the different files so there was nothing too much worried about we just made the comment but in the real world scenario this is where the things gets tricky and git so the whole idea is git always tries its best to resolve these conflicts right now we have a conflict but git tries automatically but git is not an AI and of course even AI cannot tell you which code to keep which code to delete so G tries its best to resolve the conflict but whenever there's such conflict happens we need to understand that how these conflicts are resolved and how the diagrams actually work on with this so first of all we need to understand this diagram here the green line or the head is actually going to be pointing towards this is the branch which you are on like for example we are on the master Branch we are trying to bring in the code from the footer so everything above these uh equal signs there will be a lot of equal sign I'll show you that in the code as well everything above here this is the part of the main branch and anything below these equal signs these are the part uh which are coming in from another branch and we have to learn how to we have to actually resolve this conflict and there's nothing to it its whole thing is that which part of the code you want to keep whether you want to keep this one whether you want to keep this one or you want to keep both it's totally up to you you can remove anything all these codes and there is no shortcut for this one you have to manually go into the code part and have to consult with the another friend that hey what your have done I have also done this work which part to keep or do you need to update your code and then send me uh can we merge the branch something like this so this needs to be a discussion so whole idea is whether you go ahead work with this and by the way uh you have to remove all these head whatever these fancy things are going to come up these equal signs and these ones just remove all of them just keep the code that you want to have save it and that's it so that's what it says keep whatever you want remove the marker and save and that's all it's going to do so yep it's not really that bad uh the whole thing is that people assume that it's going to happen automatically no it doesn't it doesn't happen automatically so let's go Ahad and check out where I am so I'm going to go ahead and work on with the branch I'm on footer I would love to check out on the master Branch so let's go ahead and work on with the master there we go uh what's the situation now Branch I am on master and there's code in the footer I would love to now um merge the branch so let's go ahead and say get merge and I want to merge the footer Branch pretty easy uh standard stuff once I do this it says uh Auto merging index conflict merge conflict index Auto merging failed fix conflict and then commit the result so notice here if I go ahead and open this up now your code dator looks a little different and depends on what is your default code editor there is also resolve in merge editor there's a merge editor here as well by the way so this is how it looks like a lot of people get afraid of this nothing to be afraid this is all all good so notice here it says these are you can by the way vs code also gives you really nice options at the top that you can accept the current change you can accept the incoming change or you can accept the both by the way this is good of vs code but I'll tell you what this is now notice here this head this is footer edit this was something which is in the master Branch footer edit successfully was the footer branch code now it's totally up to you which one you want to keep or you want to keep both totally your decision your call but notice here how similar this is from the diagram that we studied exactly the top part is coming up the stop part is coming up from your uh main branch Master Branch this everything uh be below the equal sign is coming up from the incoming Branch or incoming merge that you are going through with exactly same nothing nothing changed here now here's the interesting thing you can go ahead and click on these buttons I will not do that you try that because it's much more easier there I'll show you how the hard work hard part is being done so I can just come up here and say that hey let's just go ahead and remove this and we definitely want to remove this part we want to remove this part I think this footer message much is much more better so I'll just go ahead and remove this footer edit I'll remove this one here as well so this is best I'll go ahead and save this and I go back here and notice here it automatically fixes this up and I can just close this again and start this again and this is nice by the way in the vs code you can click on the resolve in merge editor and this opens up a a totally new editor and all of these things and it's much more easier it helps you to actually what's in the footer Branch what's in the master Branch I'll just say complete the merge uh complete with conflict yeah close with conflicts whatever that is I I'm not worried much about this code base here but you get the point which one you want to keep it's totally up to you now the branches are definitely merged so I can go ahead and check out this and definitely we do have some of the commits that we have to make by the way I can make these commits from here as well but I would love to make these commits uh merge footer branch and all of these things so we can just go ahead and add this since we have manually merged this so I'll just go ahead and say get add whatever that is and let's just go ahead and get commit and I'll be saying that we have a merged footer branch and there we go now everything looks good should be all okay and everything looks good the footer was added successfully is the message that we are accepting instead of the one so you have to pick one you can pick both as well nobody's stopping you but this is how it goes now interestingly let's go ahead and check out how the timeline looks like exactly same as before we started with this we went into this one now this is also we started with this one we did some commits and footer Index this is how we solve the conflicts so again a lot of people a lot of people I've seen are too much worried about the conflicts there is nothing to be worried it's just these extra equal signs and Arrow Signs which bothers a lot of people we does a pretty good job but yeah you got this one uh there's a lot more to discuss and talk about this but we're going to do that in the upcoming uh video right now I think this is more than enough for us for the discussion let's go ahead and catch up in the next video hope you're enjoying if you're enjoying do let me know in the comment section I'll catch you up in the next one folks my name is zes hope you're doing good and we are continuing our series on the gate and in this video we're going to learn just about the two commands uh you'll be using them often uh one quite more than the other the first is going to be git diff which tells about the differences and I'll talk more about this one and another one we are going to talk about is the stashing command now the stashing is also pretty interesting and a fun concept and you'll be using them more than you think about it my throat is little itchy but anyways let's go ahead and talk about them and one thing I would like to mention here is that the git diff command is something that you should watch out uh there are tons of flows of that I'll not talk about each and every flow but I'll give you enough of knowledge that you can figure out things on your own but be very careful about how you interpret these symbols here so I'll walk you through with that as well first of all let me share the screen with you we are on our notes section here and as you know uh this is where we have been working things and these are our directories that are working so uh pretty simple stuff that we're going through so first of all let's understand about the git div then we'll do the Practical we'll read about the git stash and we'll do the Practical just like we have always been doing all right so the first is the git diff now the git diff command shows you the differences and the one common thing that you're going to notice about this git div command is of course it shows the differences but it's not the difference between file a and file B that is the most common mistake G div command actually shows you the difference between the same file the file a and the file a the only difference is it shows you the version of that file in some X time and the Y time uh what do I mean by that simply let's just say you're working on a file and you have staged some changes now you want to compare how the file looked like when the things were not Stag and now they are in the stage so that's the comparison you want to do maybe the comparison is how does this exact same file looked like when I committed it two commits before and now I committed it how does those two commits actually compare or how does the same file looks between this branch and the other Branch that's the whole idea a lot of people make this mistake of assuming that the G diff is for comparing two different files although there are tools which can do that but this is not it it's meant for especially in the git ecosystem and uh one more important thing about the G div is how do you read the file this is where the common mistakes comes up and I don't blame it to anyone it's the symbols which makes it confusing now you'll see these kinds of minus minus symbol and these plus plus symbol quite often and this doesn't means that the minus means the things which are removed and the plus means things which are added and this is a common mistake I've seen especially for beginners or people who are in college fresh out of college that Plus+ means the files which are being added no no no no that is not how we read the things so notice here the a is going to be a representation of file one and B is also going to be file uh representation of for now we are calling it as file two but it's actually the same file I've mentioned this same file over the time but for the sake of Simplicity we are calling it as a file two obviously it is a file two now because the information got changed that's the only reason again remember the notes same file over the time okay hope we are clear now this file a is being represented by this minus symbol that's it yes it is represented by these symbols now it could be other symbols it could have be chosen as at the rate this could have been chosen as the hash there would be much less confusion but what can we say this is The Chosen One by the by the creator of the gate we cannot say anything to him he's legendary program grar so somehow he decided that for the file one I'll choose the minus minus symbol and file uh two I'll say plus plus symbol and I'll show you when we run the command we can sometimes actually interchange the branches so this is Branch a this is Branch b and sometimes when we interchange that these symbols get interchanged so never assume them that these are for removing the code and these are for the adding the code no they doesn't work like that so change in line and the little preview of it uh we are going to see that that how to read these things pretty easy pretty fun to watch around so we're go ahead and now do these things in the practical way I think that would be much more fun all right so what's our situation right now I would love to see by running the git status and we have nothing to commit we are on Master Branch now you can actually see the whole message and can understand it and our working tree is clean there is nothing which is changed and should be moved to the stage so now you're are actually able to understand this whole thing much much better and all these things are pretty good I love these blocks here by the way you can copy and paste I can you know that I can actually copy the ENT D thing and can make a documentation out of it that's fun anyways uh so let's go ahead and change the index file and do and see what things happen so we can see there is a lot of uh empty spaces here so I'm going to go ahead and remove these empty spaces all right and let's add something here so uh what should we add Navar at the top that would be fun let's go ahead I would oops I would love to add Navar my keyboard is a little far away because the iPad is taking a lot of space here I would love to na add Navar here and uh that's it and probably I'll just go ahead and say look good as project look good project so this is the thing that I have added now and obviously when I go ahead and check the git status again it says hey there's one file which is being modified so what we' love to do is uh we would love to add this file to the staging areas so the easiest thing is let's just go ahead and add the index HTML there we go now if I go ahead and check the status again we have something in the staging area and something uh outside as well which is not being changed now this is exactly the place where you can run the command of the G diff first of all let's go ahead and run the G diff command and see what happens when I run it in this exact mode nothing happens that's exactly how it is uh actually intended to work on with this because hey uh this is really basic command and on its own it doesn't do much on its own that hey what should I do or something like that now what happens is when you provide some of the options to show your intention what I really want to do so for example if I go ahead and let's just see the command line is suggesting us uh that hey just run this file and see what happens when I go ahead and do this it does nothing obviously uh but there are options my bad there are option like I can go ahead and say I want to learn about the staged that's the option which is the first useful option if I go ahead and use this uh there is a way how we should learn to read this message how it goes on let's go ahead and work on with this first of all Das Das staged obviously I want to compare the file which is in the current stage as as well as in the stage stage so there are two versions of the same file if there are multiple files obviously it will show us the multiple blocks of output for that so don't just assume that we can only check the output and the differences between the one file you can check with hundreds of files and even in the production everybody does that now it's says that hey this is a g diff which is checking between a file a and file B file a is also index.html and file B is also index.html and it's always going to be the case now there's also an indexing being given between the two uh commits and some messages around here don't want to go into too much of depth of it yes this is also a file code that git actually keeps it for themsel uh even without staging but let's not go into the file code as of now now the next thing is this minus minus minus represents the file a and the plus plus plus represents the file B this doesn't means that this is code removed or this is code being added the negative negative uh assumes that this is file before staging and this is after staging so this says that before it looked like this there was a lot of negative spaces or just the spaces and it said looks good as a project but as you moved on to the staging area you have changed this and this is the newer code or the newer version of the file that we have I would love to add Navar and looks good project so this is what we have done now just to show you that we can do a little bit more is let's go ahead and change the footer as well to just to see that how things actually looks so nice footer 2024 I don't like it probably uh add some awesome footer here that would be a better message now let's go ahead and Stage this one as well so staging is pretty simple we go ahead and say this time we want to add uh footer to the staging area and if I go ahead and check the git staging uh git status two files are being added now let's go ahead and check out the git diff as well and only option I'm providing here is dash dash staged okay let's see now we have a little bit of a different syntax uh and again notice here the colon so it's opening this up whole thing in the Vim mode don't worry I'll show you how to get out of the Vim you'll not be forever stuck into this one but if you notice this same thing happens now we are comparing the footer file here and here we are comparing the index file so we are comparing always the same file but in the different time zone not time zone exactly but in the different time itself how it looked like previously and how it looked like after the staging and it looks good and there we go we can see and it never shows you the whole file itself it just shows you some of the glimpse of it and yes there are tools around it some GUI tools like get Kraken and a lot of others which actually shows you much more information than this so notice here in the footer this was the file before and this is the file now and this is how it looks like so there we go we can see that no new line at the end of the file and there we go we can see the index file here uh which has some of the looks good and all these things and you can actually get go ahead into the full mode of the Vim but right now I'll just press Q to exit it that hey I'm I'm okay I'm fine by looking at it by the way GitHub shows you entire uh long documentation of seeing this now apart from this now I would like to make a commit so let's go ahead and uh make a commit there we go and what we're going to do is let's say commit messages U changed change index and footer not really a good message but I'll just just go with that so we're going to go ahead and add this one and now let's just for a moment I want to see the G log but on line logs now we are head is pointing towards this one and we have this merge branch and exactly like this you can actually check out the different merge options if you want to check out between the different uh commit IDs you can go ahead and do that let's go ahead and see what happened between uh this commit ID and this commit ID let's see what happened there uh it's little bit difficult to actually use that but not in my case I'm using a nice uh terminal here so I can copy paste the things all you have to do is copy this uh paste it up here then a space and then we're going to paste this this one so that we can go ahead and check this out now you do this so you get the entire thing again that hey nice footer was previously in the previous commit ID now this is was in the this commit ID and things looks good again I can press q and get the exit so you get the idea how this is being done you will see another kind of a thing with the exact same commit IDs or maybe different branch name also you just remove the space you put two dots common scenario uh alternative way of how it's being done gives you the exact same result but you'll see that a lot of people use that so that's that's the fun part as well now similar to this you can use the branches as well I'll not show you that I'll leave that as a simple exercise for you to do but pretty simple so all we can do is simply have to say G and then uh diff and then we can go ahead and say uh Branch one probably that's it dot dot and then we can use Branch 2 and again dot dot is pretty safest of the feature because it it actually is a previous compatible as well the the space one is the newest one so maybe are working in some scenario where the space one doesn't work now you know you can use the dots as well so pretty easy to work on with that and again the output will be same regardless of you work with the commit IDs you work with the branches files and however you work and go through with that this the output is going to be exactly same okay uh now let's go back on to this one so now that we understand the inside and the details of how the git diff work and from now on you will never see that this minus minus as removed h it's a previous version or not the previous version in fact it's just the file one and that's it and this is a common thing when you switch your branch comparison even the commit ID when you switch them up uh the first file will get the minus ones and the second file will get the plus one we can even try that actually uh let me just go ahead and work with that and I'll just go ahead and say get log one line and there we go so previously we did uh gave it like this now let's go ahead and uh 9C E11 so what we're going to do is we're going to go ahead and remove this and in fact we'll just go here and we'll just change this so even just by changing this you'll notice uh that there we go now this add some footer note here nice footer the plus and minus got changed here so this is really an interesting notice here nice footer gets a plus and if I go ahead and quit this and if I go ahead and use this now the nice footer gets the minus one so told you it's not really the removing of the code or adding the code it's just a symbol it's just a symbol all right so moving on let's go ahead and talk about some of the git stashing all right so moving on about the git stashing uh git stashing is pretty interesting and fun uh of of the tool or the subtool in the git itself let's go ahead and understand that I don't know why it's not highlighted but we're going to talk about the git stash okay so what this git stash uh all we have to do we'll go through with the workflow first understand the thing then we'll do the Practical of it so first what we have to do is create a repo we have to work on it and then commit it on the main so the whole idea is there should be some work on the main branch and the flow is then switch on to another branch and work on it very common scenario that maybe you found a bug maybe you want to add some feature you have pulled off a branch of it and you have started to work on your branch but uh there is something important happened on other Branch or maybe the main branch and you want to work there a little bit now uh conflicting changes do not allow to switch the branch uh without commit so what happened is if you worked on something you have probably staged it not yet commit or you have worked something is there uh the git is not going to allow you to switch into the different branch that's that's the one thing so let's go ahead and try this if how this is actually even true or how does it work so let's go ahead and first of all G status if I go ahead and work with the G status there is nothing in the master branch and uh that's okay but we want to now create another Branch right now we don't have much of the branches if I go ahead and look on the branch there is just master and there is a footer maybe now you it's the time that we work on the footer Branch so let's go ahead and check out this or maybe you are creating some another Branch so let's just go ahead and say get and I'll use a switch and you can by the way pass an option of Dash C and let's just say you're working on some bugs so we are going to call this one as bug fix a very common scenario now this has created a new Branch as well as moved you onto this new Branch shortcut command so we're going to go ahead and check out the get Branch notice we are on the bug fix so you're on the bug fix and you realize there was a pretty nasty bug in the footer index Navar wherever you like this was the bug so I went up and I have fixing uh trying to fix this bug okay we are still in the mid of the fixing the bug we haven't fixed it so that's our situation right now if if I go ahead and check out the git status uh here there are some files which are not being staged or something but your colleague says hey you know what I need your help on some another Branch uh can you please come to the footer branch and just add this or check this or just add this one line here and you says yeah of course I can go ahead and do that so I'm going to go ahead and say hey I'm going to go ahead and say get switch and not see but I would love to switch on to Branch footer there we go oh it says uh your local changes to the following files would be overwritten uh please commit your changes or stash them so now it's talking about the stash before you switch the branch aborting so where I am right now let's just go ahead and check this with the G Branch I'm still on the bug fix I haven't moved on the fo footer and I'm not able to change this so that's what this note actually says that if there is any change which is not even being staged and you have worked on something in your branch obviously you have moved some file you have changed is and you haven't committed them you haven't staged them so how can you move on to the different branch this is where exactly the stash comes in and even git actually gave you a message suggestive message then you can use the git stash and you can switch between the branch and by the way there are a couple of other uh use cases and even complex commands of the git stashing which a lot of people uses I'll walk you through with them but majority of the time you'll be just using these two commands which is git stash and git stash pop let's see how they work and I'll show you I'll show you some of the complex commands as well that how you can just go ahead and work with that let's go ahead into this one so now I can run the command git stash there we go I run this git stash and it says okay there's a work in progress bug fix and something index folder now can I change my Branch now that's the most important question so if I go ahead and say get switch footer if I go ahead and says hey you switched to the footer branch and if I go ahead and say that hey show me the git Branch there we go you are on the footer right now and you can start working on this does it change this uh yes all of my changes are being stashed there I'm not worried about there they're working pretty nice and easy uh I can see what is happening can guide my colleague or even can add more stuff on the index or something like that even can work on this and complete my commits and everything but the great part about this is I can move on to the different branch now and I can say get branch and uh move me back onto the bug fix no suggestion no suggestions hate that uh bug fix oh get switch my my bad uh switch okay now we are switched onto this one I'll check this one okay I'm here uh but what about my changes H my changes are still not here because I have stashed those changes stash is like a temporary shelf where you can keep your code go back move around come back here but you have to bring things back back from the from the Shelf here and how do we do that pretty easy let me show you uh it just this command G stash pop that's it and that's the command get stash and all you have to say is pop now you have have this so pop so there we go we are having this stuff back up here uh pretty nice and easy uh but let's just say I have worked on it more uh worked and fixed the bug something like that so there we go we still are again onto the position where we haven't committed this now you know you cannot change the branch so you would love to go ahead and use the git stash command so we have stashed it now I want to move to the main branch let's just see how many branches we have get Branch we are on to the master uh so let's just go ahead and switch to this one get switch and I want to switch to master all right my bad Master there we go we have moved to the master branch and obviously these all things are gone but here's the interesting thing I know I have stashed some changes onto the buck fix Branch but can I actually pop those stash onto other branches H that's interesting let's go ahead and try this out I'm going to go ahead and say get stash and I'll just do a pop and it says oh there's something interesting here uh on Branch Master uh changes not staged for commit go ahead and no changes added to the commit dropped some stuff but okay okay I can see that all my stash can actually come onto this master branch and now I can do the changes stages and whole things so we can deduce from this this small investigation that yes stash is not just limited to your branch and stash can be moved from this Branch to different branches as well uh but don't you worry when you're working onto this one uh with multiple people be very careful of how you're stashing and all these things and that is why people actually always stash with the other commands as well so it's a pretty interesting command uh but again be very careful about this one because most of the people love to have this command first G stash list so once you do this so for example if I go ahead and again do a get St get stash it stashes all the changes but if I do a get stash list now it gives me a list that this is a stash which is uh one which is work in progress on Master Branch so don't just uh go ahead and dump the stash unless until you are working on the the branch because stashing can be a little bit tricky to work on with so always be careful just run the command get stash list and only stash or dump the stash which you really want to work with that so for example here in this case I can just go ahead and run the command get uh stash apply apply and then mention this stash whatever the stash is for example if your in case is the stash uh zero uh like this or if you have the first one for yourself second third whatever that is you get the idea that how these things actually work all right so now that you know about the caveats of how the stashing and all these things work uh I would love to give you a couple of more commands and all these things uh make sure you're looking up for is also a couple of commands like get stash list and get stash apply and the stash name entirely with the curly braces and one two whatever the number is and most of the time whatever and wherever you are working on stash is something which is meant to be very very temporarily maybe you want to just uh put your changes for a moment and then want to go some another branch check these things uh copy some code or somewhere and just move back onto your branch this is entirely made for a temporary purpose you should not be relied on it too heavy and uh even in if you're working with the many people in a big company these stashes uh should be used very very carefully so that's the whole idea now let me show you a couple of more commands and I'm pretty sure you can do some exercise on it and we'll we'll talk about this one so uh what you can do is so far we have used the command of checkout I'll show you the demo of this one and this checkout actually goes ahead and we have used it for the branching checkout from get checkout Branch uh Master get checkout footer and all these things but it can also be used uh for uh checking out how the things looks like before the commits and all these things you can provide the hash or you can use the symbol of head and this till Day means I want to go two commits back so this two here represents look at the two commit prior to this one I'll show you this one as well and by the way you can restore any file as well the restore command is also pretty interesting go ahead try this out and you can restore the file back to is the last commit only not the like you cannot go forever you can check with the checkout command that how files look like but you can only restore till the one last command now let's go ahead and see how the checkout looks like and see how things actually work so for this obviously we need to have a g log so let's go with that now somehow I want to move uh how the things look like onto this particular commet so all you have to do is just run the command get check out and instead of giving this as a master or Branch name give the commit ID and again you don't need to give the entire long commit ID this one works like 99.99% of the cases I'm not sure about one Edge case there but it works like that so I can go ahead and work with that get check out and just work like this and notice here what says the head is now now at this position so I told you this whole thing that we have in the gate this is something which has to point somewhere this head and usually this points towards at the very uh tip of wherever you are working right now but we have explicitly asked it to move be uh back somewhere so that's where the head is and during that time uh or where when we worked on this there was no nav bar there was no footer file and this is how our file looked like so I can go back uh jump into the time and check out any point of the time but the point is how do I go back that that's the main interesting part so do I have to get log again uh because hi there's a head hero section here how do I how do I retrieve back so let's go ahead and try this can I go ahead and use this uh get checkout head let's see what happened here oh this is this doesn't go back so uh what can I do to go back if I have checked out onto the previous branches now moving back is a little bit tricky uh not really complex but there are a couple of ways how you can go back and let me show you what are these ways actually uh the easiest one that you're going to find is uh where am I writing uh is simply go ahead and say get check out and instead of saying head or something like that uh you just go ahead and say I want to go back to the main branch uh or in this case the master uh that's one thing I can go ahead and do this uh you have switched to the ma uh master and all of this and we can see once you mention the name of the branch it moves you back on to wherever you were uh in case you forget this what you can do is there's also one command which is rarely used in the any flow is uh simply say uh get reflog uh what does this command does uh reflog actually moves you back onto where you were uh previously it just moves your head back to wherever you were so in case you forgot from where you came in or something you can use this but rarely being Ed rarely somebody just check out and then just like it's everybody's flow that instead of um mentioning the exact thing or something we just mentioned the branch name this is a common flow but yes again there are many ways of how you can go back so you get the idea of now you can check this out any point of time that I want to go uh head should be now on two commits back or one commits back let's just say we want to move it here so this is two commits back so we can go ahead and say get checkout and we want to point the head and we can use till day and move it to two back and there we go so we have now head is is now at CB 9e where is cb9 a and we are here uh cb9 e so o uh we are one and two and it moves it here cb9 e so be very careful where it's moving and uh be cautious about it so that's what I'm saying so there we go this is how it was looking like and again my usual flow is just go ahead and say get checkout and then move to master so that's it that's usually what I do but again it's up to you you want to use reflog you want to go with that totally on totally on you all right so a couple of more commands so again we have worked on with the git checkout and we can use the hash we can actually go ahead and use the head command we can use the specific commit ID to move there whichever suits you whichever works for you and even we little bit talk about the reflog as well so go ahead and work with that in case you want to with that it's a pretty easy command so that's it for this video I hope you have enjoyed this one so if you're enjoying these uh please do let me know in the comment section tweet TI about the series because your tweets your share on the LinkedIn this is the only thing which keeps me going this is my motivation and uh I would love to get some more motivation at this point of time that's it for this video let's catch up in the next one hey there everyone my name is AES and welcome to the series on the gate our today's topic is pretty interesting uh which is a little bit scary as well uh we're going to talk about the G rebase I'll walk you through what what are the cits of it what could be the accidents that can happen with this command but all under control you'll have full knowledge about when to use this command when to avoid this command and you'll not be scared of it and there are a couple of scenarios that I would like to talk uh before jumping into this command first of all if you haven't checked out my Channel or haven't yet subscribed go ahead hit that subscribe button it would be really really motivational for me or if you can share this series that would be fantastic I have put a lot of effort into this you're one share that that's the price of this Cod that's it all right so first of all let me share a simple scenario so what we're going to learn about this one this git rebase command you'll find the entire internet is kind of divided into two halves and one half is on the 90% which is scared of this command and only 10% of the folks actually love this who have used this extensively and they really know what they are doing it's not that scary of a command but it can it always does rewrite the history and when you are rewriting the history you should be cautious and that's what this command exactly does I'll tell you a personal scenario uh when I was working as a CTO in one of the company here in India and uh in that we were organizing a lot of hackathons in our company and a group of students uh came in and they accidentally ran the rebase command wrong way in the last one hour of the hackathon and their entire project got messed up and they couldn't participate so yes you should be careful with this I'm not sharing the horror stories I'm just sharing what happened there the truth happened there and uh you should be cautious about it that's all I'm going to say and now let's go back onto the code and walk you through with how actually it goes on and work with that so let me share the screen all right so where we are right now let's go ahead and check the git status for this and my keyboard is too far on the left I don't like it that way but but what can I do uh so let's go ahead and go ahead and say I want to run the git status everything is good on the master branch and how many branches do we have and by the way I love this feature that I can scroll this and can say I want to learn or I want to run the command the G Branch so I can just go with that I love this uh so we have couple of branches couple of things going on everything is well sorted well centered up here let's go ahead and first run about what happens when you run the git rebase command again the red Smiley here with saying hey be cautious about it so this command can be used as an alternative way of merging or can be used up as a cleanup tool cleanup tool because it rewrites the history and an alternative of merging because it literally performs the merging but uh in the merging you actually keeps your branches uh separately but it just merge everything into a single timeline this is how the output is is something which you'll see when you rebase and this is kind of an output you see when you actually do the branch merging so yes this is exactly like merging we already have seen quite in depth about how the merging Works uh but now we're going to see the how the rebasing of the stuff works all right I'm not going to go through again with the merging process you are quite familiar with that whenever we do the git merge it actually merges the code into the main branch or wherever you are merging you can just go ahead and work with that uh now we'll focus more on the rebase but I'll walk you through with the branching scenario as well a little bit we'll go through with the demo quite in Deb now here's a caution note uh whenever you are either on the main branch or in this case we are going through with the master quite a lot or the master Branch never run this command I repeat this again if you are on the main branch or Master Branch this command is not meant to be run from that Branch this command is usually meant to be run from the side branch that we are whether that's a bug fak footer uh feature whatever that branch is usually this is meant to be run from the branch itself not the main this is usually the guidelines which everybody puts out Whoever has worked in the big large scale Corporation this is usually the guideline but again we're going to go through so again don't worry about all these big long commands that we have here we have a really long ones you don't have to worry too much this is just walking you through that how the whole flow actually works but since I'm with you uh I can just go ahead and work through with that all right so let's see what happens so first of all we are on the master so let's just say what happens now is uh we go through and by the way we'll be keeping an eye on this one so this is whole things in going on and how the things are working with we are more interested in this diagram because this is the only thing we have all right so first of all let's go ahead and work a little bit so in the index section we come up here and we say uh this looks nice oops again keyboard is a little shifted this looks nice I save this I go ahead and check the get status you obviously know what's about to happen there is one untracked file we're going to go ahead and commit this this time I'm going to use- am which is another shortcut of adding and committing at the same time so we're going to say updated uh main website looks good and we have done the commit now where we are at this position looks good if I check this one and I check my the UI now we can see that uh there is some work that is being done in this one uh we have some stashed being onto this Branch as well uh what this branch is if you can just go ahead and click on this you can just see this is the footer branch that we are working through uh we're not much worried about the footer Branch that's okay that's fine I'm not worried on that Branch uh let's just say there is another branch let's just go ahead and see this one uh there's another branch which is the bug fix and let's go onto this bug fix Branch I'm going to go ahead and say hey let's check out the bug fix bug fix and now I'm on the bug fix Branch let's go ahead we work a little bit on the bug fix Branch I fixed the navigation bar bugs maybe we have to contact us was not working I will just cut this out I'll just use an anchor tag it's not going anywhere this this was the bug let's just assume I'll just say contact us now now the bugs is bug is being fixed all right uh but if I go ahead and check it out at this point uh my bug is fixed let's go ahead and get and we're going to go ahead and commit and we're going to go ahead and say let's just say the bug is fixed but I still need to work a little bit more onto this one so I'm going to go ahead and say updated navbar that's nice there we go if in the meantime I want to go ahead and do some more work on the master Branch so let's just go ahead and go ahead and do get checkout and we want to go on to master Branch there we go and in the meantime the master is also working if I check the git Branch we have this one working on this one so I guess that's my uh not in the Commit This one is but we have updated the main website so this is the pink one and in the meanwhile there's some more work on the index file that was done and I want to say what do we do on this main website uh maybe some Gallery was added some images were added images added so there we go images is being added and what do we want to do commit get commit and same and we're going to say images added all right now let's check out the another branch and again this is kind of a workflow that we have to go through I'm not making this up so let's go into the bug fix again and there we go now when I go into the bug fix obviously the index file is having nothing but it would be really nice if I could bring in the whole code base uh from the main branch into this branch that would be really nice and this happened quite often more than you think that we go ahead and merge the main branch into our bug fix Branch so whatever has happened on the main branch can come onto my branch and I can see what's the latest update quite common thing so we're going to go ahead and say get merge and this time I want to merge so wherever I am first of all I need to check that I'm on to bugfix and I'm going to go ahead and say get merge and this time I want to merge the main branch or the master in this case by the way the main and master you might see me often uh exchanging the name between Main and master there's a history of it let me share it with you so initial days when the git was designed everything was called as Master branch in fact in lot of other uh Dev op toools like kubernetes and all these things we used to call one master and others say slave and somehow some people find that offending so nowadays we call everything as Main and others as regular branches so that's why get is a pretty old software still does the main branch as the master but on the GitHub they don't want to have any conflict so they call it as main branch so Main and master are literally the same they are just the branch name okay so let's go ahead and do the merge uh Master once I go ahead and do the merging of the master uh it says hey there's now edit edor this is usually the default message I'll go with this only merge main Master Branch into the bugfix I go ahead and save this and close it and go back up here so files are being added now everything looks good if I go ahead where I am right now I am onto the bug fix if I go ahead and check out the bug fix onto the index all of these images and everything came into my picture but what some people don't like is this guy so now this there's this extra commit that hey there's whole thing going on now again I can start working on this I'm still on bugfix I'm still working on the navbar bugfix and this about us is the link whiches was not working so I added an anchor tag goes nowhere and about us so we have added some more stuff and we worked onto this one we will be adding a commit message and I'll say bug more bug fixed or I'll say about us fixed these are really bad commit messages but somehow we we work with that and if I check this kit branch that again uh Master is doing nothing and all of these things but in the meantime you went up and changed this one yes we need to go through with this whole workflow so that you get the idea of how things actually works in the real life I'll go ahead and do a check out and I'll check out onto the master and uh get to check out and my bad need to run Master now we are on the master Branch we are still working on index file uh images pricing card added all right so we have added the pricing card the throat set still itchy but anyways a pricing card being added I want to uh add this and I'll say pricing card added all right uh let's see what's the situation of this all right now more work is done on this one so there will be new commits being added this is how the life is uh now you want to get all those commits that are done being done on the main branch being migrated onto your feature Branch or the bug fix Branch wherever you are so this is something which is bothering to a lot of people that if I go ahead and check out the git log uh get log and on line uh you'll notice a lot of commits are just the merging commits so this is the merge of the Navar this is merge of the footer Branch these commits are not actually putting any work they are just merging and same thing is happening if I go ahead and do checkout onto the bugfix branch and do the git log again why my cursor went away and I go ahead and do this again notice here uh the same thing is happening here uh we merg this so these are unnecessary commits that are going through and a lot of people don't like it so what do they do uh let me show you now first and foremost the most important thing to learn about this is where you are so never be hesitant to run the git Branch I am on bugfix this is where I can run the command of rebase if you are in the master and run the rebase the whole mess is on you not on me make sure you understand this key point so now what we're going to do is now we want to bring all those changes here so I'm going to go ahead and say I want to do a rebase all right but re base uh needs to run on the master brand so this is the command that you usually want to run get rebase main or get rebase master this indicates that I'm rebasing my Branch with the master you don't want to mess up the master Branch or the main branch now notice here what happens when I run this command rebase successfully and now what you can see the timeline is being Rewritten the timeline is Rewritten this is scary because now the main timeline is it's literally rebasing what we are doing is rebasing that means uh we still have two branches here but this is my main branch and its base is now here so this is the point of its base so this is the most important part we still have Branch we still have two heads these are just the pointers which can point onto different uh points or different commit IDs but this is my Branch this is literally you have you have taken the branch and have replanted it on the master this is scary this is because you are rewriting the history at this point probably you might not be able to understand the severity of it but notice here the branch is entirely gone it's just the master and if any more changes we will obviously be diverting into the branches if any more work is done on the buck fix more branches we'll see those colors on line it's not like we have entirely removed it for the future as well they will exist I'll show you that but this is the point where things actually gets a little bit scary so again uh checking where I am I am onto the buck fix branch so if I go ahead and add some more stuff uh maybe I'm fixing the same nap bar uh let's just cut this out oops not like that I'm going to go ahead and cut this out add the anchor tab goes nowhere Home tab is also fixed now so let's just go ahead and Commit This get commit and we're going to go ahead and say that uh Home tab fixed not really a big fix but maybe that's a th line code I'm going to go go ahead and you're going to see this in the commit ID get graph now that uh yes our uh the fix actually is now the same on the home branch and Al as well as on the buck fix but the moment you'll do some more things on the master Branch you'll see the commits ID being changed so we're going to go ahead and say hey let's go ahead and check out the master there we go do some changes on the master we are doing more changes in the index pricing card what else uh we have y a section y a section being added go ahead save this do the commit y Us section added go ahead and run this one and let's see the G craft there we go we can see the branching is here so it's not like we have completely removed that you cannot have branches ever but here is the interesting part where we have no idea of how the branching came in bug fixes we have just merged it and even if you look at the commits the commits the unnecessary commits that were there like uh merge the branch merge the branch those commits are gone that's the whole idea about the rebasing and in case you are wondering what happens when there is a conflict uh exactly same what happened in the branch when you merge the branches when you merge the rebase it's exactly same if there is a conflicting file you have to remove the conflicts manually or use the vs code to accept the changes and all of that and you have to run another command so interested in doing the conflict why not let's go ahead and do the conflict uh we are on to the branch of Master all right so let's just say the master has worked on it let's go ahead and check out onto the bug fix as well and we're going to go go get check out and we're going to go on to Buck fix and this Buck fix guy comes into the index and says uh prizing card added and he also says a new prizing card new prizing card added so we are working on the same file some stuff is being added which one to keep which one not to keep it's up to you I'll just save this because we are here to make conflicts let's go ahead and do the commits and I'm going to go ahead and say uh card added to index file not added add card to index file uh usually you want to give the command to get it on that again uh let's go ahead and work with that so now what happened is hey there's a conflict in this and uh let's just go ahead and run the branch we are on the bug fix so it's safe to run the command if I'm on the branch I can merge or rebase from the master let's go ahead and see what happens when I try to rebase uh let's go ahead and find out the command that we want to run rebase the master I do this and it says rebasing couldn't do the rebase because there is a conflict here and here are a couple of hints you really don't want to skip this part read this entire uh whole message if you're not going to be reading it you'll not understand the rebase so go ahead and follow this it says re resolve all the conflicts manually mark them as resolved uh with hint uh then you have to run the git ad or remove the conflicted file so you have to run the command git add yep that's the thing and then run the git rebase and my terminal is a little short can I expand it yep and there we go whole thing in one line now it's better all right notice here this is the one that I want to get your attention to you have to add this this is the first part of it and then you have to run the get rebase D- continue that means the rebase right now is in the halt phase you have to resolve your conflicts and then I'll can continue the rebase if somehow you find it little bit scary uh you can go ahead and use the dash Das abort command as well to abort the entire thing if I go back onto this one here notice here this is the resolve all these things and you can just click on this accept changes last time I showed you how you can do this manually by removing all of this this time I'll show you how you can use vs code I'll say that accept the current change accept the incoming change or accept the both I'll accept the incoming change which is coming up from the master Branch I'll accept this this is how it looks like new pricing card added and I'll go ahead and save this but that's not enough I need to go ahead and literally uh come back here and add this and again you don't have to commit this you just have to add this so I'm going to go ahead and say get add in this case it's just one file but you can use the dot feel free to use that I'll just go ahead and add this but that's not enough now it needs to be only in the staging area now you can continue this but if you go ahead and check the git craft notice here uh uncommitted changes and all these things it's it's an ongoing thing so don't just worry too much about it and we're going to go ahead and say get rebase and the dash dash option Dash D continue thank you so much and by the way if you hold on to this one it says uh restart all these options I love this editor uh restart the rebasing process after having resolved conflict merging really nice I hit enter and it says uh add card to the index so now it's asking you to for the commit message I'm happy with this commit message I'll save this close this file and you get that now finally the rebase thing is completed so there's no such thing as like automatic M conflict resolver or something but we we get to see this that whole thing is again uh just a one timeline so literally we are actually changing the timeline so it took us little bit time to actually understand that how the workflow and everything is done but I think by now you actually truly understand what the rebase is and uh again I would like to bring you one more thing up here that again uh never rebase the commits that you have shared with other people and if we are pushing to the GitHub never rebase is usually the idea uh but again uh it's not like I'm against the rebase you can rebase and some companies do actually ask you to rebase all the time some people like to keep their commit history being very very clean and not unnecessary commit that's okay that's the workflow you will learn some people have the have the workflow or their experience with too much rebasing some people have rarely have done the rebasing so it's up to them they are scared of it or not I am little bit but I know when I'm rebasing what I'm doing so that's the whole idea so the whole point of the picture is rebase is not that scary it's just you need to know what you are doing if you know that what you're doing it's always good idea and again never do the rebase when you are on the master Branch always do the rebasing when you are on the bug fix branches or some other branches that's the workflow I done but again your workflow might be different or something else so that's your rebase I hope you have enjoyed it if you have enjoyed it do tweet out this video or the entire video however you like that uh let's catch up in the next video hey there everyone a here back again with another video and welcome to the git series and git series cannot be completed without talking about GitHub and yes I know GitHub is not the only way of saving your git workflow and dire code base onto an online service there are others as well but hey we cannot do anything the popular one is the popular one I don't decide the popularity so the popularity is with the GitHub so in this video we're going to see a little bit of the GitHub and how the workflow actually goes through with that now I am pretty sure some of the beginners who are afraid of doing the things on their own and absolutely hate to read the documentation are going to complain it little bit on this video and the reason is obvious because I'm going to mention you some of the documentation why the GitHub and I'm going to ask you to do some things on your own people don't like to do things on their own and that's the reason they leave programming my advice read the dogs try to do things on your own at a Max you're going to just fail and you're going to find Solution on some medium article or chat GPT or some other stack Overflow but it's it's compulsory and important to read the docs and do some things on your own and there is a reason behind it I'll walk you through with that as well and we'll share you some of the important information if you're going to the GitHub obviously we'll have a discussion about the open source contribution you need to know what are the cons of it first because there was recently an in incident the entire world was very much unhappy with the incident I'll share that incident as as well so be cautious about spamming anybody on that we'll start with there uh but let me show you first that why I'm saying that a lot of people will be unhappy with this video might be unhappy not always but might be so all right so we are on to the docs. GitHub and we are on the getting started or get started page this is the documentation of how the GitHub entire workflow goes through and if you go on to this right hand side you're going to see that onboarding using GitHub accessibility explore projects get started with the git and a whole lot of things are there so using the git if you open up this is how the git sub folders and all these things are being used and explore the integration about the integration and whatnot all these things are here so using GitHub you can see there is a GitHub mobile uh onboarding is also there how you can start your journey there's there's a lot of things how to create an account hello world finishing up and whatnot now if you go ahead and search for this in this docs regarding the SSH this is the one that you have to search because just go ahead and search for SSH now the reason for U for searching the SSH is that first of all let's go ahead and talk about the GitHub so I'm going to open up this new one and we'll paste the GitHub here so this is GitHub this is one of the many such online services which helps you to keep all of your code base along with the git maintenance and the git timeline onto a cloud environment so that everything is safe these days we know that everything is on the cloud and and for obvious reason there is no worry about your database getting corrupted your hard disk getting corrupted everything is online on the cloud and they manage all these things and it's not the only service which is available GitHub is the most popular one but there is a gitlab uh if you wish you can just go ahead and explore them we will definitely explore them together maybe uh in upcoming videos not sure about it so yes there are lots of such Services coming back uh this is the GitHub which helps you to build and there's a lot of options and a lot of things are available here here we will not go much about them in this video we'll definitely explore them in the upcoming video but all you have to do is just sign up for that once you do the sign up it's pretty easy all you have to do is enter your email verify the email set a password and that's it you have your GitHub account you are watching this on YouTube you obviously have a YouTube account that means you know how to create the account similarly just go ahead and create an account on GitHub once you go ahead to create an account on GitHub then simply working with the GitHub via the terminal is the most important thing and you can not just work with the terminal using your uh email ID and password no GitHub doesn't work like that GitHub works with the SSH keys so you have to generate some SSH key and have to save that same key in the GitHub settings page so that GitHub knows that you are the same guy who's communicating the communication in the GitHub happens on the basis of SSH not on the basis of uh email and password email and password works well on the web not on the command line and since you know we have been working with the command all throughout the long and we want to use GitHub directly from here by the way you can also install a GH utility which is a GitHub utility you can work through with that uh but first anyways since we want to connect the entire thing with the GitHub we want to have an SSH key on our system and we want to have an SSH key on the GitHub settings page so that both knows that yeah these are the same guys in communicating so first and foremost the problem is these are the two things we want to explore generating a new SSH key and adding get to the SSH agent uh and the second one is adding a new SSH key in your GitHub account these are the two things that we have to go through with let's go ahead and open this up in two separate tabs and by the way they are just one above the each other you can just get started with any of them so the best part is even if you click on Mac windows or Linux the steps are exactly same almost exactly same the only thing you have to worry about is on the Windows when you installed the git uh git SCM remember we in the very first video went through the git - SCM you downloaded the Git it also gives you a new terminal which is known as git bash and I highly recommend to use it instead of the Windows command line uh it's great but I'm not a big fan of Windows command line go ahead and use the git bash all the Linux command like LS PWD all of them work fine with the git bash now once you have this this is the something that you have to do on your own and it's not much it's not much trust me so all you have to do is whether you're on Windows or wherever you are open up the git bash and run this command this command and make sure use the email ID which you have used to sign up on the GitHub and then uh notice here if you're are using the Legacy system that then only you have to use this one otherwise we don't have to use this one we will go with the latest key this one after that simply go ahead and this creates a new SSH key using the provided email as a label and it will generate this then you have to do is enter a file in which to save so uh Windows user obviously you can save it into users you and thens search and this the idore algorithm this underscore algorithm will be exactly this algorithm so in this case we are using ed25519 so this will be your file name idore idore ed25519 so that that will be your file name uh once you're done with this uh then simply you have to enter the passphrase uh if you can keep it empty that's also fine but whenever you'll make it make a get request you have to enter the same passphrase if you are setting one I usually don't set one I'm just happy with without that so once you're done with this uh adding your SSH key to the agent this is also you have to do so all you have to do is uh just come up here a new admin Elevate so go ahead use the Powershell of the windows and follow these commands and that's it you don't have to follow this step Noe nothing you just have to work through with these two commands get service name this is just copy and paste and then simply SSH add C drive and all of this that's it copy paste stuff that's it if you are on a Mac you have to do the exact same stuff on the Mac as well exactly same in the Mac also we have SSH key so go ahead and use this this is going to generate the same algorithm but your algorithm will be saved on different place which is/ user SLU SL and again idore algorithm this is important to know from directly the documentation itself because these may change in the future so it's better always to come here and find how to do the things so this is what you have to do again prompting and all of these are same for you and for the wind uh Mac guide this is what you have to run to make sure the SS agent in the background and then hey just open up this file and just create the file doesn't exist just go ahead and create this and just add this so couple of more steps for you but that's it till here that's the only thing you have to do uh do not do the things here generate new SSH for Hardware security we don't need that so yes literally three four steps you have to do on your own and there are so many articles around it that will help you to now the whole idea is once the these things are saved the SSH key is being generated open up that SSH key in vs code or any other editor that you want you have to copy this and paste it uh at a very special place let me show you where that place is uh I'll show you this open source contribution in a minute but first let's go onto the new and go up here and what you have to do is uh you will have exactly same kind of account and if you go up here on the homepage this is how it looks like and we're going to just click on this and click on the settings you also have to do this and you have to click on this SSH and gpg keys and this is the place where I have to hide some stuff from uh my screen so notice here once you click on this it gives you all these my existing Keys which I have hidden just click on this new SSH key and just give it a title and we will choose the authentication key not the sign-in key authentication key is fine and just copy paste this stuff here and that's it now you'll be able to communicate with your GitHub account and by the way in case you are worrying about that there are so many articles depicting exactly same if you go ahead and search for it how to add SSH key in GitHub uh maybe on a Mac you'll find so many articles and what you'll notice in these articles let's just say this is the medium article that they are pretty old that is why I'm referring you to documentation look at this 2019 although not much have been changed but yeah some of the algorithms has changed we don't use RSA anymore uh that's the one thing but if you'll notice these are exactly extracted from the same documentation uh they use the just the PB copy to copy that and that's it go into your uh window this GitHub it's a pretty old one go to the settings go to SSH Keys uh simply new SSH key and copy paste it that's it that's it maybe you have to add your password that's that's the max so this is I this is why I say this is so much important and a lot of people are not going to be following this but I cannot do this the SSH keys are very sensitive even I have to hide some of my SSH keys on the screen itself after the post-production this is important step here so now that assuming that you have painfully gone through with this whole step of connecting and all these things uh I think that's okay and all done now what you have to do once you're done with this uh go up here and together we are going to be working on uh creating a new repository and then we will learn how we can talk to the GitHub and how we can work with that so for that we're going to go into a new directory so let's just say where we are so let's go work with that we are in the git 2 so let's go ahead One Directory back and do a quick LS we are we can go into the git 3 now so let's go into CD and we're going to say git three there we go uh no my bad git 3 there we go and now we are obviously into the git 3 let me go ahead and change my code editors uh directory as well just give me a second I'll drag and drop onto this one and we are learning the git and we are in the git three so I'm going to just drag and drop into this one here now we are into this fresh repository where we are having all these things now let's just say we are building a website and we know the workflow of it now only thing extra that we have to do is connect everything to the GitHub and push the things onto the git itself let's go ahead and try this I'm creating a really amazing website I'm going to call this one as index.html I'll use a basic HTML docs here I'll just say uh get website and a simple H1 that has some of the LM text that's it that's my website now how does the flow of this entire thing looks like we have to work through with the git so we know that we have to initialize the git first and even before initializing we would love to know the status of it there is no get repository here we shouldn't be initializing it again and again that's why I check this and then I go ahead and say get in it to initialize my git repository there we go git is being initialized and if if I go ahead and check the G status now it says one untracked file is there we can quickly go ahead and do the commit so I'm going to go ahead and say get uh commit and we'll be using- am to quickly go ahead and add this and we're going to say add index file looks good all right so all right get commit oh we forgot to add but it should be done add index file nothing to be added what happened should be working fine okay all right I'm going to add this get add and now we should be able to usually it works but don't know why it doesn't work add index file and there we go now it's being updated let's go ahead and check how it looks like onto this one let's check the this one looks good and we are on what branch I would love to know that as well because this will be useful in a minute we'll be going with the git Branch VR on the master Branch all right now let's just say this is a very complex project in itself and I want to save it on the GitHub itself how does that looks like and how does that process work and do I understand this whole thing now from the git itself you can just go ahead click on this and create a new repository and we're going to call this one is uh learn dgit and this is available because it's Unique for my account you will be able to do exactly same because it will be unique for your account then we have to provide a description a test to learn G there we go you can keep your repository public or you can keep it private as of now I'll keep it public but I'm obviously going to be deleting it later on you can go ahead and add readme file we'll talk about the read me files in a minute but uh G ignore we have already worked through with that we don't want to push the git ignore from here as well although GitHub provides you an option to do so we're not going to be touching licensing as of now and I'll be just removing this this is one plugin that I actually go ahead and use this but it's fine you will not have this option this is for me my personal professional use all right so we're going to go ahead and simply say create repository now the moment you create a repository you'll be provided with some of the commands and we need to talk about these commands these are very important one so if you notice here or create a new repository in the command line we know a lot of these commands first of all the commands where we see all of this things like Eco can I zoom this some more there we go so if if you go ahead and see this this Eco command it does nothing it just creates a readme file in our case uh we have this file already being created our index.html is already here I'm fine with that then it says get in it I don't need to do it again because I have initialized my repository I have seen so many students and beginners who mindlessly copy paste these commands they don't understand what they are doing that's a bad habit you know exactly now then it says get ad read me so in our case it will be add index or dot whatever you want to use then it says get commit we have also made our commit now this command says git Branch dasm main now don't worry this- m is just to rename your existing Branch git knows it very well just before I shared this incident that it used to be called everything as Master git don't want that git want you to change this as main although there is nothing wrong in pushing the master but it's not a ideal situation so we're going to use this command- m to change the Branch name let's go ahead and do that uh we just have the master so we can just go ahead and say get branch and we can use- capital M and we can change it to the main suggestions are there as well so now if I go ahead and do this and check the branch I am on the main branch literally just a command to rename the branch now then we have something known as git remote ad origin and then this long name which is ending with the git and then it says git push dasu origin main this is the command which is actually responsible for pushing your code not just pushing your code but actually to streamline your flow now what is the Streamline what what is this happening all up here this is where we need to study the theoretical part of it so let's go ahead and study the theoretical part of it I know a lot of you are not big fan of it but we need to study of it okay so this is the discussion regarding the GitHub so let's go ahead and talk more about it so git is a software and GitHub is a service to host your git online as we saw there are many other services which are available and GitHub is known just not for hosting all of your softwares and all of your G information online but it's a collaboration tool it's used for backup it's even used for open source and we're going to have a separate discussion on this open source stuff and how it is helpful to understand the code base and all these things there are others as well gitlab I showed you there's even one one more bit bucket you can use that now a couple of commands that are going to be coming up uh very handy uh the first one is git clone we'll talk about that git clone as well in the later on videos don't worry about that but first of all the most important command that we have already studied is uh git config d-g Global user.name and provide your username similarly you have to provide the config d-g Global user. email and provide your email whatever is your email uh there's no such thing as you're exposing your email or something it's okay no worries on that uh you have to do your SSH key setup uh and again remember this uh GitHub doesn't allow you to push code with the password password a password based code push is not allowed on the GitHub only thing you have to do is configure your SSH it's not really hard try this couple of times and you will be able to succeed this is how software development learning curve works you don't see everything into the tutorial or videos or or something sometimes you have to read the documentation and go through with that okay uh check your instruction for your OS on the GitHub website as I showed you this the best and updated resource uh all these resources over the time gets outdated whatever is the best way uh recommended way is available on the GitHub website all right now let's go ahead and talk a little bit about the remote because we have been working with the git so far we are comfortable with that on the local host on our machine now it's time that we move on to the remote repository so couple of commands that we're going to go through first of all is remote- V this command will help you to figure out and see that whether do you have any remote repository being set up I have my local repository on my system remote repository is on the G up so I need to know that whether there is any setup for that or not and I can just verify that by saying get remote and I can say uh Dash we as an option and it's going to give you an empty result empty result simply says hey there's no connection there's no remote configuration being set and then you have to do is add the name here so what you have to do is get remote add that means I want to connect a remote repository I want to have a connection with them you have to add a name and have to add a URL and if you notice something on the git website it just tells you exactly same git remote add and then this is the origin and this is the name of this whole website and it is usually called as origin uh but it's just a name it's just a name that I'm calling it as so on the GitHub we are calling this as origin that's what the name I'm adding in the remote repository and you'll notice in the next command it says that push uh and this I'll talk about this dashu it's a pretty interesting one but right now just ignore this oh you are not able to see this there we go uh so this is where it is okay so this remote ad is origin this is the name of you can say Branch not really correct but you can say it as Branch so name of this uh repository on the GitHub is named as origin and what I'm saying next is push into this origin from my main from my main branch you can change the branches as well you can say that hey uh production or you can say deploy Branch whatever the name is push a deploy Branch to the origin that's the most important part A lot of people just mindlessly copy paste these commands you don't have to do that okay uh let's go ahead and do this so the step one is to add then provide a name and the URL we are calling it as origin but feel free to change this the usual thing that you're going to see is uh git remote ad origin I don't really like to change it because everybody calls their remote repository as origin that's what the GitHub says in the documentation so I'm not a bit advocate of changing it so origin and then provide the name and usually like 99.9% of the case this is going to end up with the dogit that's that's the clue of it then you have to Simply go ahead and say get remote and you can just go ahead and rename uh old name and new name so yes you can go ahead and rename that there is nothing stopping you I'm not going to do it but I'm showing you that yes the option exists all you have to do is get remote rename and then rename it from origin to Superman nobody's stopping you to do so and you can go ahead and remove this as well get remote remove the name so if let's just say you don't want to push it on the same repo you can go ahead and change the remote name as well and you can change and push things onto that now the second command that we need to discuss this we have already got enough discussion on this one is this one git push dasu origin main this is interesting one uh first of all let's go ahead and add this now that we know this command we can actually go ahead and by the way uh notice here it says or push an existing repo from the command line they actually says hey this whole stuff you already know only command that you need is to add and configure your remote repository so that's actually easiest one and most of the time you're going to see a lot of people just come up here and copy it from here that's why they have given this copy option directly to you because they know people who really understand the G they just need this thing here and again you can go with HTTP version or you can go SSH version most of the people prefer the HTTP version SSH version although we have configured s for authentication and pushing the code I usually prefer the HTTP method and they also recommend this one here so what we can do is simply go ahead and copy this now we know the command we know what's the meaning of it we understand this command so let's go ahead and say that get remote add and just go with that so we're going to say get remote add and we're going to call this one as origin and then paste this one so this is what we have now let's go ahead and try to enter and see what happens all right nothing happens that's good news and if I go ahead and say get remote V now it gives me that there is an origin which you have set up this is for Fetch and this is for push push that means if I want to send any code this is the remote repository that's that will be used if I want to fetch anything this is the remote repository that will be used uh usually they are like again in 99% of the case they are the same but hey there's nothing stopping you to change this one as well all right let's go ahead and talk about the next next command command that we have so remote origin is being set now the next one is get push and all you have to provide is the name of the remote where I have to push and the branch name which you want to push in our case the remote name is origin hope you haven't changed it to Superman and my branch that I'm pushing up is the main but there is no such compulsion that you have to all always push the main branch you can push the production Branch you can push a bug fix Branch Nobody Does that but maybe maybe you can do that and again we're doing is uh get push remote and then uh it the whole syntax is local branch colon a remote Branch there's no colon involved in this one you just have to mention any that's the whole idea so go ahead and work with that now but in our option on the GitHub we saw one more option this is not like I'm telling you just you can do get push and origin and Main but what this dasu option comes up here uh this dhu option is a pretty interesting one uh let's first go ahead and do this uh directly so we're going to go ahead and say get push and we're not going to be using the dashu we'll just go ahead and say origin and Main now if I just go ahead and use push origin and Main notice what happens when I go ahead and hit enter it tries to just push the code on the GitHub all right without dashu option we were able to push it so what's wrong in this nothing actually I can go ahead and reload here and the whole code is being pushed and I can see my index file and the code that I have which is very small code I have this code on my repository so why we bother even about having this dasu option let me show you that if I open up this code file and let's go into the code part and index file let's open this up eventually after some time I realize I need to add paragraph of 30 words in my code and there we go we have added the paragraph what do we want to do next we obviously want to add this so we're going to go ahead and say get add index.html we have added this we want to have the commit we're going to go ahead and say get commit and we're going to say this time we have uh add paragraph to code there we go we have committed this so This commit is done and nice what do we do after that uh we obviously have already got the remote set so I can check this I don't need to do this again and again remote repository is set being once or if you're updating you can set it again but most of the time it's just one what if I do want to push it now can I push it directly if I go ahead and say get push and no origin no main can I do this it says I don't know what you're trying to push the current Branch main has no Upstream Branch interesting what this Upstream is to push the current branch and set the remote As Upstream use get push Das Das set Upstream origin main so what this Upstream is and what do I need to know about so whenever you are actually trying to get push you obviously are setting a stream with some of the remote repository and so that later on you can just push this you have to set these options and that's exactly what the GitHub was trying to do with all of us so if you see this git push dasu origin main dasu setups an upstream that allows you to run the future command the future command of git push so that you don't have to run this git push origin main again again what we doing is we are setting an upstream we are linking the origin with the main so that whenever you do a push automatically from this Branch whenever you run the command uh get push it automatically links the Upstream origin with the main and pushes the code on the GitHub it will not happen on the other branches because there the Upstream is not linked that's why you are completely safe to just do this and in fact why would you run the command of git push there but this is the linking process uh the git push in the future will directly push the code to the geta that's the whole idea so in case you want that accidentally I should not be able to push this uh don't use the dash shoe option but if you want that hey this is little bit overwhelming for me I'm going to go ahead and set up the Upstream you can use the set Upstream option just like this that's completely valid but since GitHub loves this to be a little bit of the shortcut that's why they give you dashu it's exactly the same no changes at all so if I go ahead and do this uh it will obviously push the code but from now onwards what I can do is I can update more stuff so let's just say we are going to use unordered list we'll be having a list item uh maybe three three of them and we're going to say home and again about us and we're going to go ahead and say contact us so we have added a navigation bar or list now obviously you want to add and commit on that let's go ahead and do that we're going to say get add index file just like this we're going to go ahead and say get commit and we're going to say add what do I do uh commit hm add a list and by the way do you know that I can actually run multiple cursors here I don't know I forgot the shortcuts yeah there we go so you can see I can I can write on the two places at once this is the most amazing so notice it yeah it doesn't make sense here but yeah that that's the option I've never seen that in any other terminal anyways having just fun with the terminal okay so we have added the list all right and now I can literally go ahead and do get push no option nothing is required uh these all are grade out they are not commands and I can do this it does the pushing automatically for me so this is really really nice thing to work on with by the way you can just go ahead and check this out if I go ahead and do a refresh and we're going to do index HTML and we can see yeah my amazing important list is now here all right uh let's go ahead and work on with this and understand a little bit more of that so uh when you clone a repo we need to learn a little bit about cloning of the repo we'll be doing that and we can switch the branches and all of these things uh these things definitely we are going to study a little bit later on that how we can actually fetch some of the repos uh how we can bring some of the existing code on our repository on our local system can understand the branching and all of that uh we'll understand the bit of the commands on that but first uh let me go ahead and show you some of the interesting stuff so if you go ahead this is how it looks like on the remote repository now just like every web server picks up the index.html file similarly onto the GitHub what you can do is you can add a readme file this readme file has a special extension known asmd shortcut for markdown and the markdown syntax probably I'll create a crash course or something some another day but right now this is just your heading so we're going to say something like this learn about git and GitHub and we're going to Simply say something like this yeah we have to do this and we can go ahead and add some of the code bases as well uh maybe if you don't like this you don't have to do this this is just fun and I'm going to go ahead and show you that yes you can write codes here as well just like this no no need of python oh all right so this looks okay we don't need this come on there we go so whatever you want to write in the markdown file you can just go ahead and do this now let's just go ahead and add this we're going to go ahead and add readme.md and we're going to commit this we're going to Simply go ahead and say this get add add read me file and I can just go ahead and simply do get push nothing else once you actually go ahead and push this file then what you're going to noce this is that GitHub automatically picks up this read me file and shows you some stuff here on the homepage of the repository that's why it's required and you can see the code that I wrote now you have the copy command that's that's the GitHub charm of it that they are trying to throw on top of it but anyways you now understand this whole thing now coming back on to the part where we wanted to discuss this part that how you can bring some of the pull request and all these repositories and all these things so there are a couple of more commands and we have to go through with this so the First Command that you're going to go through is the top one which is this one so you can just run the command get clone and then the URL of any repository that you want and you can bring that code onto your system so that you can understand it better and go through with that let's see if we have some of the code repository and we can work with that so I'll go onto my code base and I'll try to find something which is a little bit short and small I'm pretty sure there are thousands of these things thing so we're going to go ahead and use something okay I did made a series on goang maybe you want goang source code so what we can do is we have so much of the source code onto this one and I want that to see and bring all of this in here so I'm going to go ahead and say uh onto the code I can go ahead and download the zip but since we are all are the git users and we are pretty professional now I can just go ahead and copy this https by the way there is SS GitHub CLI other options as well you can install the GH utility I'll use the GitHub uh https method and I can just go ahead and copy this now we can clone this on wherever we like let's go ahead and move on to One Directory back if I do an LS I have one 123 we have already seen that but I can run the command of get clone and paste this so now whatever is there on this repository will actually be brought down U you can see it's getting downloaded if I do a quick LS uh this is one here and notice here goang I can just go ahead and open this folder up here and this is the goang so entire codebase is now with me and I can open this up in my favorite editor go ahead and work with this and whatever I want to do this is the code file that I have I can go ahead and work with this so that's the whole idea behind having this entire uh git clone command and all these things uh but what will happen is uh maybe multiple people are working on the same repositories and things like that so sometimes what happens is uh we need to understand this with the notes itself is let's just say you and your friend are working on some remote repository uh so there are couple of things which we have already noticed now we understand this entire flow that there is something known as working area where the work is going on you haven't staged it committed or anything then we saw that there is a staging area where we stage the changes staging doesn't means commit you haven't committed that but once the staging area is done we actually commit the code and this is known as your local repo so everything we have done so far before the GitHub introduction that is your local repository and once you're done with the local repository you obviously go ahead and push the code on the GitHub that is known as your rep remote repository so all this is this is your limit of the working repository this is the limit of your staging area this is the limit of your local repository and this is the limit of your repo now imagine this scenario you and your colleague are working on the the same code basis and you're making the push directly on the GitHub everybody does that there is nothing exception in that but let's just say you are building a index file and your friend is building a navigation bar and you realize that hey before pushing the index file or before pushing the footer I would like to grab all the things which is updated on the GitHub so that I can make a fresh uh push onto the GitHub repo now you will learn a couple of commands onto that and in fact by the way if you look onto this one if I open up my VSS code you'll see these commands if you just click on this Source control you'll see these commands here as well I hope you can see that there is a pull there's a push and there's a fetch all these commands are here so it's not like something alien there's a fetch here and there's a pull here both of these commands actually bring the code from the connected remote repository to your code base not the git clone git clone just brings it at one at a time but if you are actively contributing in the repository uh and then the things are different so what we have seen right now goang it is just bringing the code but here since we are actively contributing in this remote repository some of the other guys might have done that so if pull and fetch both brings the updated code from the remote repository what's the difference between them there's a difference okay when you run the command get fetch this actually gets the info but don't put the things in my work so what it's doing is it just brings everything into your local repository but hasn't brought in the work into your work area yet when you do the git pull command it actually gets all the information from the remote repository and moves it into your working area and yes there are use cases for both of them there are scenarios where you want to just fetch you don't want to pull it into your code base yet uh maybe you want to First verify is it breaking my code or uh is it not touching my code is it not overwriting my code once you are done with that then you go ahead and do the G pull again depends on which company you are working what workflow you are going through just remember the git fetch actually uh gets the info but doesn't put the things into your work while on the git pull it actually gets all the things uh by the way uh git uh pull is a a combination command what it does is git Fetch and git merge so yes you get it right all the work that you're seeing in the remote repository uh you first do the git Fetch and then to bring it from here into working you do the git merge uh but most of the time we just run the git pull and again git pull origin main uh changes will be merged to the main branch whatever is there in the origin so just keep in mind uh these are some of the common things that you'll be seeing as long as you remember this whole diagram uh you'll be all fine in bringing any of the code into your local repository uh couple of more discussion about uh the things uh before we go ahead uh that GitHub has actually a lot more feature I'll walk you through with some of the features it has features like adding the collaborators multiple people can work on the same file you should be the owner of the repository a readme file we have already gone through with that mark down briefly touched onto this one you can by the way add your own gist guest whatever you call that uh these are code Snippets it has options like code spaces it has options like dab container let me show you where it is so uh what the options are if I go ahead and open up the same uh goang what you can do is instead of the code you can actually run the code space as well so what what's this code space it's a kind of a VM it's kind of a virtual machine so and virtual machine is not an ordinary virtual machine here this is configured based on what kind of code you are having so this code requires goang setups so it will open up a Dev container or a virtual machine which will have the configuration and the installation of the goang if you open up a repository in code space which is something like react nexs or some JavaScript uh then it will open up the code space like that so GitHub is a pretty more powerful tool and you can go ahead and configure this repository however you like I'll not go much deep into that I've already talked about it on my channel so no this is not the time to talk more about it now a a couple of things if you want to play more around it I'll definitely walk through with this now let me share one more incident with this uh you so you can see on my uh repository we have this open source contribution so let me just warn you something about it before we move into the next video and talk more about on these situation so GitHub has a way uh in which you there are some of the code bases which are open source and you can contribute your code onto that code base now people I don't know what they were thinking uh they thought that it would be really cool if I go ahead and update these small readme files and put up the contribution all these contributions are spam contribution they are not adding something something to the code they are not putting value into the code base and they started doing all these update readme files and all of that and the entire expressjs repository was like spammed with it not a good idea so I to drive the traffic in in sarcasm I said hey here is your open source contribution all those who want to spam or something just go ahead and do this people didn't understood that sarcasm and started to spam on this repository as well but that was okay because it was created for this intentional purpose and you can see I still have 220 commits there are still pull requests and all these things I'll walk you through how these pull request and all these things are made uh but that's okay uh just remember you don't have to do this don't spam anything uh if you want to contribute add value that's the whole idea so any anyways I hope you uh you have enjoyed this small talk and small lecture not small really big one but now that you have gone through with the all this thing you don't have any fear about the git and how the things are actually working you're are comfortable with the git and the GitHub and how to push your code you understand each and every command why does it exist what role does it play is it a shortcut or how does it work and that's my goal to make you comfortable with the git that's my number one priority that's it for this video let's catch up in next video hey there everyone AES here back again with another video and how can we just conclude our git and GitHub Series without talking about open source so I'm pretty sure that a lot of you are very much excited about open source and a lot of you think that open source is probably a Gateway of getting the job and this is a kind of a misconception that is floating around and I would love to talk about it and no I'm not denying that open source can possibly open some of the doors for you as a credential and a credibility that you can write the code and understand the large code bases and yes sometimes these opportunities do come around but we need to understand the whole open source ecosystem first of all why I'm going to discuss about this so if you look at this I do myself maintain a couple of open source project not alone me uh we have a team maintainers and all these people who work around it and this is one of the biggest open source project which is growing quite a lot and a lot of people are using this to learn I'll talk more about this this is not the only one uh we have couple of more which are in the pipeline which are about to come very soon so yes I do have some experience with the open source of contributing it in it and maintaining in it and uh being the founder of the open source project so yes I do have my credibility backing me up and I would like to talk about it so first and foremost see open source is not just about making your source code available on GitHub or bid bucket or it's not about that anybody can walk in and just contribute in that code open source is way more than this open source is a philosophy that hey software can be or should be distributed for free so that other programmers can save some time and it's my contribution to the society to the community of programmer that's the whole sense of it and I think the open- source projects whether how small it is or how big it is should never be considered as just taken for granted it should never happen a lot of our software Engineers who are working working as a full-time job as a software engineer as a team lead as a CTO they love to contribute in the ecosystem of the developers through the open source project they make their software which is really amazing The Amazing software that they're releasing to the world and allowing us to just contribute in it make the software better and add more features on that software now this is a great practice and this is this is wildly appreciated throughout the community and it's a good thing but a lot of people sometimes actually take this for granted and abuse these maintainers of the project just because the software is not working the way they want it to be on some of the edge cases and some of the people just think that this is a shortcut of getting the job and they just mindlessly without adding the value contribute in these softwares this should not be done so in this video I'll walk you through the entire pathway of how you can do that how we can make the pull request how the open source project should be read and found out about it and all these things I hope this video is going to be the most valuable part of the entire series and uh hope you'll enjoy it so I have uh prepared a kind of a road map for you which you can follow and then we're going to talk about how we can do all these collaborations and pull request and whatnot so uh here's a small road map uh which you need to understand and these are the steps you have to have to follow there is no other way there is no shortcut for it the step one of contributing in an open source project is talk yes the first and foremost thing that you have to do before even thinking about contributing writing any single line of code is talk to the people you'll see that in any of the software you'll notice here that any software that you are maintaining this is the actual repo of the open source project notice here there's a tab known as issue and you can go ahead and create a new issue and can just mark it like how do you want to get started maybe learner API is here uh front end contribution request whatever that is open a blank issue you can just go ahead and do that but that's your first step to talk to people if there is a mention of the Discord server or slack talk to the people we have personally seen that some of the people who were working on some of the uh features uh they reached out to us that hey uh we have done the work entirely our code is ready can you accept the pull request and we said no we cannot we were not aware that you were working on it and we have already finished our work and we are pushing it on our own uh they felt really bad but hey we were not aware of the thing that you were actually working on this feature if you would have been working we would have never spent our time we would have allotted this entire feature to you so the step one is always and always talk to the people I have no dreams coming about that you are working on some feature I do know that I want to know that what you are working or what you want to work on without talking there is no open source that happens so Step One is talk to them Twitter Discord slack doesn't really matter talk to the founders and the maintainers of the open source project if the the reply is coming up late don't start working on it that's not a good idea then the step two is open an issue most of the open source project these days are living on GitHub but if they are living on some else some another platform it's okay they also have the uh option of opening up an issue until unless you open up the issue there is no way of uh finding and that issue can be anything maybe I'm not really a big fan that you are fixing up some of the things in the readme I absolutely don't like it uh but let's just say if you're doing any small modif if ification you're adding some functionality open an issue that I want to work on this thing or there is a small bug into this one I want to fix this bug or maybe there's some more thing I want to add onto this one this is what I want to do so open an issue for this one and since you're already talking to the developer then go ahead and get that issue assigned to you and developers will do that they will assign this issu to you and they'll be taking care that okay somebody is working on this issue they will give you the timeline as well that hey we expect that you might be done this with this issue in 2 days 10 days whatever is the timeline doesn't really matter now once you're done with this remember this part which is work and add value now if you're just fixing a dot in the readme file if you're just uh correcting the small grammar I do understand correcting the grammar is also an important part but you are calling yourself as a programmer so I expect that you'll be contributing the code first and then the documentation it's an important part I do agree a lot of people might pull my leg just by saying uh that hey you are you are saying documentation is not that important but in the open source Community we have seen so much of the nuisance just because of the readme that now we are all bitter on that so just go ahead and work on this and add value to the project and this is just one project like free API the API Hub uh but there could be others as well like python is also open source uh JavaScript V8 engine is open source if you understand that code and you think you can add some value to it the whole idea revolves around this this highlighted part which is is add value and yes documentation have its own value when you write the entire gigantic documentation rewrite it entirely or something like that it should have enough of the work that's all I'm saying take it in the wrong way if you wish to but all I'm saying is add value now once you're done with this uh make a PR also known as pull request I'll walk you through how the pull request is done and then iterate over it it is not expected and it should not be expected by you that once you make a pull request it will be accepted just like that sometimes there are conflicts and that's common and sometimes they want that hey probably this code was not up to the Mark we want you to it trate over it we want you to add this Edge case also maybe you need to work a little bit more that's how things works in the software industry things doesn't work on the one go so make the pull request but be ready to iterate over it now the feedback might come up in 1 Day 2 Day 10 day because these maintainers also have their full-time job they are also busy folks they're maintaining it for the community so have patience that's the key that's the key have patience and wait for it uh once uh you are done with this and your pull request uh is accepted then hey go ahead and go out celebrate because you have contributed in the community that's it that's it celebrate it post it on Twitter post on LinkedIn that's it that's the whole idea that I have contributed to the society I have donated to the society uh once you donate anywhere you don't just expect things in return that's not the point of donation and you're donating your code to to that repository so some people assume that making pull request is a job guarantee I've made a pull request I work in open source that means I'll get a job in it sometimes that happens but sometimes it doesn't happen that's how the expectation should be it should be just a donation if you expect that I'm working in open source I'm contributing in the code uh that means I'll have a job it's a job guarantee thing no it's not it's not it surely is a proof that uh you can understand the large code bases and every single person who will be hiring you will be will be noticing very clearly that what contribution was done is is it just another spam contribution in the readme file then obviously you'll be avoided in the entire discussion of the job and salaries but if that contribution is pretty good you have added some code which was which was previously the breaking change and now it's a good one again it's it's all good one here so again keep in mind and the step one never ever forget that talk talk to people without talking there should not be done all right so uh this is the step and you can see there are a lot of issues in our as well so some of the bugs are there some of the feature requests are there we have also requested some of the Help Wanted uh documentation guide if somebody wants to do it we have big CJs some of the bugs enhancement front end help wanted so there's a lot of things that goes on with this and uh we have closed them 35s are being closed so we constantly close them and you can see some of the pull request are being made as well obviously we'll go through with these pool requests but you can see there are two comments on this so we are having a back toback discussion on this so PR in the draft uh do you want me to review it or until wait until completion I'll let you know for review it so this guy has made a little bit early pull request uh but our maintainers are asking that hey uh this pull request seems like in draft do you want us to review it so that we can either merge it or can say that hey you need to do more work so again uh our community is pretty active but notice here the good part is that saruk whoever is contributing here he's communicating he's talking to us not making any uh spam pool reest or something uh so yeah that's good and notice here resolve conflict so we have to work hard we have to resolve these conflicts as well and understand the code base and whole things but the important part is how do we make these all pull request and all these things uh in order to make this pull request and all these things what we have done is uh I have actually went ahead and created another account from another of my email and this is an OP Source test project and again there could be another such project and what we're going to do is now we'll copy this and then there's nothing much in it it's just an index file which says Hey learn to make pull request there's nothing in it uh the whole point is not to write code in this series that I do in other videos but the whole idea is to make you understand the flow of the G so first of all I know this URL so I'll just go ahead and copy this and then I'll simply go ahead and go onto this one here and let's go ahead and open up this one so we'll just go ahead and add this one here so this is something I found interesting as an open source project that hey this looks pretty complex it just grabs the email sends the email handles the payment G God knows what but it it's a really fairly complex project and I want to contribute in it maybe I'm using it in some of my personal work and it's just failing in some of the edge cases I want to fix them up and not only just in my code base I want to get it fixed on for other people's as well so the step one is go ahead and let's Fork this one so you'll find a lot of things by the way you can just go ahead and download this one as well there's no problem in it but in order to make this pull request uh I'll just go ahead and Fork this so you can see the drop down as well that hey existing fork and all these thing I'll just click on this one so what this will do is this will bring the entire source code in my account as well uh the open repository name is open source which is available and again you can change the name doesn't really matter I'm just copying and pasting and you can copy the main branch only but there's an option of copying other Branch as well but it's totally fine and we are going to create a fork that means bring all the code in our account so I'll just go ahead and create this one now what this has done is it has forked the entire uh code base and everything in my and this is not my code and it is a lot of people just walking you through a lot of people just Fork these repositories and feels like hey there's a lot of contribution in my account anybody who is experienced programmer and who is looking forward to hire you they can immediately see how much of the work is forged and how much is your work now once this is all done let's go ahead and copy this onto our code as well so I'm going to go ahead and copy this let's go back and do a quick LS and we are on to this one and how do we bring the whole source code in this folder pretty easy we can just go ahead and say get clone and paste this and once I do this uh now let me just go ahead and open this code on my vs code that's how you do it let me just go ahead and open this and where is it h open source there we go so I'll just drag and drop this folder here and there's nothing much onto this one now I am assuming that hey there should be some significant contribution into this one so I would love to do a contribution in this and again I hope you assume that understand this point that we are just putting a demo here understand the Big Flash word is demo so I think that there should be an Navar into this one so I'll just go ahead you might be wondering hey this guy adds too much of the Navar but before we go ahead and add Navar and all these things uh I would not love to go ahead and do all these things in in the main branch that's that's not a good idea so if I go ahead and simply CD into this one which is let's go ahead and do Lis first this one is open source so let's go ahead and we do open source if I go ahead and say get status that's always a good idea to run and it says you are on the main branch and if I go ahead and check the Branch so this is the main branch and the good practice is you should not be troubling somebody's main branch directly since you're working on something else uh why don't you create your own Branch bug fakes feature ad feature request and all these things and do your work in that branch in itself uh let's go ahead and do this so what we're going to do is I'll just create a new Branch so I'll go ahead and say get checkout and I'll use a dashb option and we're going to create a nav bar and nav feature Navar is good I'll just go ahead and call this one as Navar now we are onto this Branch let's go ahead and verify I'm in the Navar branch and I'm going to go ahead and add a Navar do HTML of course oops shouldn't be a comma rename this and we are going to go told you my keyboard is little off and we're going to go ahead and call this one as nav and order list list item and we're going to say again same home we're going to go ahead and say about us and contact us contact us there we go all done all good now what's the next step let's go ahead and push the code we're going to go ahead and say get add and we added a navb bar. HTML and we go ahead and Commit This add navbar feature to code it's really fun so now this is all done and it's pretty good that we have added and updated and all these things are good let's go ahead and check out the remote this is something that we have already learned in the last video so I'm going to go ahead and say I want to check out get remote- V and my origin is already being set why because I've cloned the repository all these things are already set for me and now what I want to do is I want to do the push so I'm going to go ahead and do the get push now I know that there's a push for origin as well so I'm going to go ahead and say origin and On the Origin this time I want to add my Branch just in case you missed out that let me just go ahead and say the branch and there we go Navar so what I want to do is this time I want to say get push and On the Origin I don't want to push the main but my branch which is Navar and again as I told you in the last video uh it's not always compulsory that that you push the main only to the origin you can push any branch to the origin let's see what happens when I go ahead and do this now whatever the code that I have done is being pushed to uh this this Branch up here okay uh again we don't want to open or anything like that uh looks pretty good let's see what has happened onto this one let's go up here onto let's minimize this we don't need it much and notice here once I come back here and hit a refresh sometimes you probably don't need to hit the refresh you'll see that the Navar had recently pushed 23 Second and it gives me a compare and pull request so what I've done is I have foged the repo and I've created a new branch and this is where I fixed the bugs added the feature and whatnot now I can go ahead and compare and pull request the whole idea is sending the pull request means hey I have made some changes I'm sending these changes to the main owner of the repository so here everything is mine because it's a fort one but I don't want to keep these changes with me probably this that's the case but in this case I want to compare and send the pull request so in this pull request you have to be very very cautious this title and this description should be very very thoughtfully written take your time there is no hurry in it if you take 15 minutes if you take entire day that's okay this will help the maintainers to actually understand what you really want to push and uh what help does it making this and notice here you'll also notice that the base reposit is AES pw1 that's my another account and uh this is where I'm asking that hey merge my changes into your main fire in in your main branch that's sensitive Branch so be very cautious what you're doing this is sensitive work but we are sending it from our Navar and we are changing merging all this thing here so that's the whole thing in I want to send from my Navar from my open source from hes open source to whoevers I'm making this and this could be anything like python Maybe JavaScript V8 engine so again these are really the software the backbone of the internet be very cautious if you're merging something on the main imagine how how how I I cannot explain it words you get the idea that it's very sensitive thing and again add naar feature to the code no it's not a good idea you should write it more and add the description more about it like um something like Navar added and then just go ahead and again by the way you can check out the preview as well so this is the markdown syntax again and just write a detail description detailed description of your work and again there should be bullet points about it like uh one and there should be two so all the details that you probably want to add this should be added notice here this is how it looks like so once you're done with this uh go ahead and use the headings balls italics whatever you want again write the detail description it should be easier to read what your code is doing take your time there's no hurry in it once you do this you can go ahead and make a create a pull request so we're going to go ahead and make a pull request now this pull request is being sent now somebody who is uh going to work on this project let's go ahead and minimize this now this is where I see all these pull requests so if I go ahead and check out this notice here there's one pull request so this is where the whole things comes up now somebody needs to go through with this and have to check okay uh this is the bar edit this is the detail description this is your entire work looks good is it breaking my code is it not breaking is it adding any value to the code base or something like that this is uh done nicely I will obviously go ahead and check your commits I'll check the diffs as well like how the diffs is being made what is the commit details uh everybody goes through in it and verify it manually okay this is the new code that has been added this is the new files that are being added how many files were changed so somebody needs to manually go through it there is no automation for this one and there cannot be one because it's sensitive stuff so once I go ahead and do all the review changes and all these things I go back to the conversation probably I want to ask more questions I'll go ahead and ask you questions and all these things once the whole communication and everything is done uh we are done with the talking and the maintainers are happy that H this is interesting one you have done a good job uh they can go ahead and merge this pool request so I'll go ahead and say add nav bar and confirm the merge and that's where your merging happens and that's it now our code base if anybody go ahead and checks checks this your very valuable code that you have added to the code base which is Navar is being added to this open source and if you go ahead and check out the commits you you'll see that that hey this commit was pulling up this one here now if I go ahead and check out this one here if I go ahead and refresh this you'll notice this uh pull request successfully merged and closed somebody have done this that now you can go ahead and delete the branch whatever you want to do but this is the whole entire process of uh making the codebase and all these things now in case you want to just practice of how this is being done and all these things uh I highly highly recommend to Simply go ahead if you just want to try that's why I've created this uh open source and there is one let me just go into my profile and if you go ahead and check this in the repository if you just want to have a fun with this uh this is the open source contribution a lot of people just work on it try how the pull requests are being made no year how many pull request I sometimes accept them but it's not a very valuable contribution it's just fun stuff you want to test out things and I understand that part that you need also your testing uh it need to be scratched so that's that's there uh notice here there's a lot of pull request going on and somebody people are trying that how it's being done they also want to just try things out and that's why this open source contribution I don't really mind it don't do this to spam on any other repository just on this repos this is made to do the spam so go ahead and do that no problem at all so I hope this actually gave you an entire idea of how the open-source project works up and how the contribution is being made in the open source how the pull request work and these are all collaborative tool being given by the GitHub itself and GitHub issues GitHub pull request manager and checkers and there are a couple of others like GitHub code spaces they are amazing tools even we have GitHub actions which is moreover a part of cicd pipeline a bit towards the devop side we'll probably cover that in some other course or another video but the whole point is that now you're are pretty much comfortable with the git contributing it my only request to you is use git in your daily life until unless you start using it as a daily driver uh it's not going to be much fruitful for you to watch these videos use it daily that's the whole idea that's the whole point you have learned something you got the knowledge use it every day all right so I hope uh this was a pretty fun Journey for you you have understood the details uh the importance of the things you are pretty amiliar with the git now the workflow of it you are pretty familiar with the GitHub as well uh do let me know if this video Series has helped you or uh you have enjoyed this and if you have enjoyed this do share it with others as well uh it gives me immense pleasure when you share these things on Twitter on LinkedIn it makes me really proud that hey the work I'm doing as a teacher it's reaching out really and it's helping out people uh that's the thank note that you can send me and I would be super happy with that so that is it uh that's it for uh the entire series of the git and GitHub uh do watch out in the future I'll definitely bring more series which are more complex and have another topics I already do a lot of videos around it so do check out my YouTube channel as well subscribe that and we'll surely catch up in the next video