Complete Git and GitHub Tutorial using IntelliJ |Git Production Release|Merge,Rebase,Stash,Release.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody welcome to today's video what i'm going to cover today is on how to interact with git using intellij why we are going to use intellij for interacting with kit is because if you are going to use java or scala as a development language you are predominantly going to use intellij as the development ide so why do you need another tool or another interface which you need to master for interacting with kit which is just a version control system if you master the gui that comes about with intellij we don't need to concentrate on the git commands or the command line as well which has a separate learning curve learning it is very essential because you'll need to learn it or master it in such a way that you are actually able to interact with multiple team members and resolve issues pertaining to version control and intellij makes life easy for all of this so with these things said let's quickly get started on how to interact with kit using intellij so as a first step uh we'll go ahead and create a new project in intellij uh we can try to create a simple java or a scala project so what i'm going to do is like i'm going to create a new project and okay so let's create a maven project so the main idea or funda is to create new files and try to interact with git using intellij so we are not worried whether it's going to be java or scala any programming language or whatsoever so let's uh put the name as learning get in tilly j okay so that's the project name i'm gonna give so it's gonna create a new set of projects or a new project okay so a basic maven template project would be created that's what is my understanding so a basic project with the bom.xml has been created and we'll try to add in some java files and see how we can interact with github okay so as a first step to communicate with kit using intellij we need to expose this project to the github okay so for that there's a command here so if you go to the vcs menu there's something called as import into version control okay so there you can just click on create git repository so once you do that it's going to ask the same thing and it's going to like create a git repo for us if you sort at the start there wouldn't have been a master branch here so if you rewind the video you would have found that there wouldn't have a there wouldn't have been a master branch created here so now once we exposed our project to git a new master branch has been created so we will see what is the local branch and what is the remote branch all of the details a little later so now a new project has been created and it has been mapped with git okay so now our objective is to add new files into this repository okay so we'll see about these things local changes console and the log part so these three things are the important aspects that we need to learn when we are going to interact with git using intellij so let's go ahead and quickly create a couple of files uh one each in the uh main as well as in the test folders okay so like we'll create a dev class okay so this warning or alert will come and where intellij will take on the responsibility of adding your files to git so that you is usually done using the git add command so you can either ignore this and choose to add it manually i usually do that uh so i have i haven't added this file to the git yet okay we'll see on what is add and what is comment etc a little later so we will quickly go ahead and create in another class here dev test class i will try to add i'm not going to going into the concept java etc but uh we'll try to just put in a psvm and shout okay class okay just just for like learning sake we'll try to put the same method inside the test okay so we have two files okay so two files have been created we will see how to interact or check in these files okay so the first option is like go into this console uh into this perspective so if you go into this perspective there is this concept called change list where you see all of the files that are available and all of the files that are ready to be checked in okay there's something called as unversion files which will just show us all of the files which are ready to be checked in and are not added to the git repository so for you to check in a file or commit a file to the github repository you first need to add it okay so that needs to be done here so you need to add this file so this is the file that we are going to add it to the git repository go to git and click on add here so then it will move into the change list okay so the class that is ready to be checked in or the files that are ready to be checked in we'll do the same process here git add so two files are ready to be checked in okay so we are having two files ready to be checked in here okay so if you go ahead and see the console so you'll see a huge amount of commands running so it's it's you can ignore these credential helper and these flags and if you see the basic interaction that we do using the command line is taken care of by intellij over here so it's just doing git add ignore errors another flag and our file path as simple as that so these two commands are executed now and let's quickly see how to commit it into our local repository which is the master the master branch so now so this is the log i'll come into that a little later so select these two files and right click commit once you do a comment you get this window where you can perform all uh these kind of operations like reformatting code rearranging code i'm not going to touch any of it you can explore it for yourself a little later we'll add our first comment initial comment and there's a commit and push option option which i'll talk about a little later push is nothing but pushing into your remote repository so i'll come into that now okay so now if you see in our master our changes have been committed again for you to verify you can go to this uh console and see what is a comment command that has been executed so the git comment the file name the message and what are the files that have been checked in will all come in this console okay and for your information is read only so just to keep track of what are the commands that are getting executed and now if you see there's the initial commit log that has been given here and this helps us to identify in each commit what are the files that have been changed so if you see here there's a brief description about the change who had done it etc and where is the head whether it's in which branch etc so all of these are pretty easy when you use intellij so that's what i wanted to cover today so now what you see is a local branch version so the main objective is to push your changes to the remote repository where other team members can interact with your get repository so that we'll be looking at now okay so click on this master branch okay there's this local branches there's an option to create a new branch we can do that a little later click on the branches name push it okay once you do the push it will just give you this option when you're going to push in any tags you need to check it we'll do that a little day later but now you need to define a remote so where exactly are you going to push your changes so your web url your github account your repository url has to be mentioned here for doing that we'll click on this and it's asking for a url for this we need to create our own repository in our github account and give that particular url here we will quickly see about that process now so this is my repository so if you go here go to the root you can just click on this new command new repository and just give the same name as we've given here learning git intelligent you can give a different name but i'm following the same name so now it's done so i'm going to just create a public repository give it a small description and create repository so now as we've created the repository if you click on this link you can quickly uh get this url so this is the url we are concerned about so this will help us to have a relation between a local branch and our remote branch so i'm just going to paste it here i've just copied using this button here and i'm going to paste it here and now it will ask for our credentials so now it's going to give us a one final chance of checking which files are there and what are the changes that you've done okay so now i'm going to go ahead and do a push okay so now we are getting an error here okay so for this what is actually there is like github has removed the authentication access okay uh like using the passwords okay uh username and password way of accessing intellij from git has been removed or any repository for that matter for this you will need to create a token for yourselves for getting access to the remote repository we will need to either give our username and password credentials or a personalized token so the username and password methods were removed as of august 10th or 12th or 2021 so for that reason we are going to go ahead and create a personalized token which we can use for logging in so for that we need to go into settings go to developer settings okay and then there are three options here for that i'm going to use the personalized access tokens and create a token here or just say like learning get intellij i'm going to just generate it for our project it's it's a global generation that can be done over a period of seven days or till whatever you can even give it a no expiry date but i'm going to give just seven days just for and select all of the scopes uh whether to check in like workflow management writing packages deleting all of the admin access everything i'm going to give i'm not going to leave any stone unturned i'm going to give all of the access here once you do that you can click on generate token a personalized token will be given copy the token just keep it handy copy the token and keep it in a safe place you won't be able to see it again okay so you when when you're done with your work or if you want don't want access you can delete this token but now since we are going to work on it i'm going to copy it in a safe place and then use it in our intellij ide so for using it in intellij what you need to do is like you need to go to file settings and in settings you have to go to version control okay in version control go to github okay so my old credentials have expired so i'm going to create a new one uh just be aware of this option here use token we're not going to use the username and password as it's disabled are now they are expecting either the two-factor authentication or a personalized token so i'm going to give this personalized token and login okay so since i've already used a token if you're doing it for the first time you can use that approach i've already used the approach so this is the option i'll need to follow hope you're aware of that so if you're going to add a new user you can use the approach of clicking on the plus button if you're an existing user and if your login or token has expired you need to follow this approach okay just make note of that point so now the new token has been generated and it has been authenticated we'll just apply it and now if we go ahead and do a push okay click on the master click on master do a push and just verify your classes for one last time and do a push [Music] yep good so the changes are pushed to our origin we'll see what is an origin quickly we just verify where is our project so this is our project so cool so our initial check-in is done the source folder the main java everything is present so we've successfully created a repository using github and interacted it with using intellij okay so our initial checking is successful [Music] so next what we need to do is like we need to check various options like how we are going to make up uh changes like if i'm going to add a new file here or a new line of code so how how the change list or how the behavior is like how modifications need to be done we can see here so once you touch this your change would come here it comes as part of the default change list okay so if you're working on multiple aspects of a project you can create a new change list say you're working on a logging you're working on data processing so all of these things like it's just a way of segregating your files okay just before you check in like there's a way to segregate these things okay it's similar to stashing i'll come to the come to that a little later but a change list is something is like uh what are the files that you're going to keep handy for the later chicken okay uh so i'll come to stashing a little later so now we made a modification in this single file and we are going to check in this file it's as simple as just check this click on right click on it comment file the same old comments uh same old window comes in and let me just put it just comment that's it so now the comment has been done so the understanding of a comment and a push is very essential here so once you do a comment your changes would go to this local master branch okay so there's something called as a remote master branch the remote master branch is nothing but this folder so whatever changes say like if two or three folks are working on and if he's if he or she is going to commit some changes into your remote you need to make sure that all of those changes come in here as well okay so what we need to do now is like we need to push our changes again okay to the remote okay so now click on the local branch and do a push again just verify if this is the change that you did absolutely yes you're going to do a push absolutely easy now the change we'll see whether it's there all of the changes are done here so now we've seen how to interact with kit using intellij and how to add a file to the git repository and to have and how to like make changes to the file that you have added so all of those things are done now so now let's say like you and a couple of other folks are starting to work on this project okay so then you the suggested approach is to not allow you to check in directly into your master branch so the approach is to each of the individuals have to create a new branch and then raise something called as a pull request okay so we'll see that process right now so now i'm going to create a new branch and the convention i follow is like something called feature slash ashwin one okay so this is the first feature brand so this is going to be a feature that i'm going to add i'm going to create a branch and i'm going to check it out so once you create a branch that branch would be checked out automatically so now you have two local branches master and feature so your next step as you would have guessed it would be to push your local branch to the remote that can be done using click on this local branch and push it just check this part again now once you do a push go ahead and check your do a reload now the feature branch is added here okay so this is ashwin working on it okay so there's another way as well there's another way in which you can work as well say like i have another account i'll try to login using another account using another browser i'm going to log into github let me login through my stream to learn account here [Music] so let me try to log in through my stream to learn account here so i've created an account using this user id okay now i'm going to try to access this repository from my stream to learn account okay so now i see the repo here so the next process that i talked about apart from creating a feature branch is something called as forking okay so forking is nothing but creating your own version of the repository that has been created by the actual code owner or a repository owner say you're working on a development team and you've been given access to a repository the first step that you can do is like do something called as fork when you do fork what happens what happens is like github creates a repository that pertains to your user okay so if you see here the user that actually created this uh repository is ashwin shakti and now i am interacting using my stream to learn account which has its own uh versions of the code okay so that multi-user so it's a way in which like multi-users can work on it so you can create your own branch here and then have your own versions of code be before you submit it for code review etc so it's like having your own copy of the code base okay as simple as that so what i'm going to do now is like i'm going to create um a change uh or create a branch okay create a branch using this account stream to learn account so since i've configured intellij with my account and the gui i'll just add a file here okay just to interact with uh or like show multiple ways of interacting with multiple files so what i'm going to do here like i'm going to add a file here or modify an existing file so i'll create a new branch same to learn okay i'm also going to show how to create a pull request okay so now i'll create a created a branch called stream to learn and edit this file okay so i'm going to quickly this is not the actual way to do it but i'm just going to do it for showing you the difference of raising a pull request uh check in from screen to learn and i'm just modifying it as train to learn okay so now i'm updating this class and i'm committing the changes to my branch so since there will usually in your development environment you will not be able to take in code directly to your master branch okay so what happens is like now i added some comments here okay so i added a commit directly here and i'm going to raise a pulled request so that i am going to request a review from ashwin shakti who is actually the repository owner and try to push in my changes to the master branch okay so once you do that once you go to this place it will just show you a stream to learn how to reason pushed a branch we'll just click on compare and pull request so once you do that it will just show you're able to merge your changes so you can just raise a pull request okay so once you raise a pull request here what happens is like if ashwin shakti is going to refresh this pull request you see there's a new pull request that has been raised stream to learn wants to merge one comment into ashwin shakti master from his own forked version so this is how multi multi-user collaboration takes place so here our objective is to go ahead and review the code so so you can just show comments you can review changes uh and as a code reviewer you can just um just give in some comments and ask them to review are now like i'm just saying like good coding and just i'm going to approve this commit so if you add a comment and if you submit review what happens is like that person will actually see what changes he needs to make the other person so now if you see like there's good coding or make some changes so i can actually put in some meaningful comments saying that make some changes in dev class so he can work on the change and he can make the change and then recommit again so let's do something like so he's going to work on this changes again so he's going to go to his own branch okay he's going to work on his own branch so even though one comment has been done so let's say like i asked him to remove the plus symbol okay so let's let's see here let's see here in this code i made some changes okay so i want to remove this plus symbol so that's the comment i had given just imagine that i've given him a comment to remove this plus and replace it with the dash so he has to go ahead and in his own id he has to do it and do the commit process as we did i'm doing it for learning's sake okay uh added the dash in place of the plus okay and he's going to commit directly to the branch and now if you go here so a new commit would be added to the pull request so his review comment has been updated so the other user which is stream to learn has worked on the review comment and he has put in his changes now if you go and see there'll be two comments the first one was a simple comment the second is like he has added a dash or he has removed the plus and added the stash okay you see those changes now ashwin has a chance to approve this pull request okay so i accept this change i and i approve this change to come forward into my master branch so now there's something called as now if you see like it will allow you to do a merge pull request or a squash and merges but what i follow is like when you do a create a merge commit it will do this pull request commit along with a merge commit okay if you see here so let's do this for this instance now i'm going to create a merge pull request so what happens now is like if you go ahead and refresh our ide here go to the log now to update the changes that have been done so now stream to learn has committed some changes okay now to see those changes in your repository or in your console what you need to do is like go to your branch or go to your master branch and click on update so once you did the update all of the changes would be coming here so what i told was like this is the only commit that should have been taken place after the pull request so this merge pull request which is just a code review that i've done so i'm not the user who did the actual code this is just a merge so to avoid this commit what you need to do is something called a squash and merge okay so that's the understanding you should have so let's do another example here so let's stream to learn work on it and edit it once more [Music] okay added more changes commit it so more changes have been added so now if you go to the pull request you can raise a pull request so you need to okay okay so now what you need to do is like go to pull request create a new pull request and make sure that your page repository is ashwin shakti learning github and master and your thing is stream to learn so now if you see there's a new comment added updative class okay so our new comment has done make sure this left hand side most almost automatically this will happen but when you refresh and when you log in for the first time but if it's not happening just follow this approach on the left there has to be the base branch on the right you have to do your own branch give your own branches name where you have committed your latest change now you've got only one commit here and you're going to create a pull request create it and now ashwin is going to see the full request so let's go to pull request here so one thing was approved and closed if you see the last pull request it has been approved and it has been merged into master and it has been closed now you have one more pull request that has come in now i'm going to review the changes again and now if you see there's this option called squash and merge just for seeing sake we'll see what is the change absolutely there now we go to the conversation don't click on this merge pull request click on squash and merge and then once you select it you have to click it click on it again now go to your intellij and do a refresh of this file and it's going to fetch all of these files that have been checked in newly so now if you see there's only one commit that has been done in your origin master so the difference between using a merge pull request and a squash and merge can be clearly understood here so once you came and refreshed your page here you are able to see that or once you did a fetch of the uh latest changes from master you are able to see only one comment which is actually the best desired result you do not need multiple comments for a single pull request so my suggestion is always to go ahead and use squash and merge okay so that's one thing we have learned now we've seen how to do how to raise a pull request and how to do a squash and merge and how an interaction between multiple users takes place and how code review takes place as well so these three to four concepts have been covered now so now let's go to the next step so the next step is like creating a stash so we'll see what is the use of a stash so let's quickly see what stashing is all about okay so let's quickly create a new branch here let's name it a stash branch [Music] branch so we name it in the feature branch section itself and now if you see the branch would be created in your local repo okay so you need to push it to your remote so once you do the push the repository will be pushed to the origin okay so the origin is nothing but so if you want to see what is your origin all of these things are all about so it's called master so this url if you want to see your git origin url so what you need to do is like sorry go to git repository view remotes if you see this there you can add multiple versions as well so if you're poking a repository and you're working on your forked version you can add that as origin and this one can be added as an upstream okay since i'm working with a single repo here i'm making it as origin so there's a way in which so if you're working on a forked version you can make that as origin and the version that you forked from can be made as an upstream okay so now what i'm going to do is like see what this dashing all about okay say now you're working on the stash branch okay and you added some code like okay so you added around 10 lines of code okay so you added so many lines of code so so many lines of code has been added so what what if like if you want to check out uh your master branch if you want to create another brand and start working on some other changes you don't want to run the risk of losing this by jet reset or like your branch getting corrupted or something like that so what you do is like previously before version control came into the picture you would take a backup of this folder and put it into another folder put it into some date and put it like that okay so just put it into folder and save it as a backup so similar to that so this particular thing if you if you want to save this file at its current form uh you can do something like um stash go to git order repository click on stash changes and here you can say my stash one okay whatever just put my stash one and create it so once you do a stash what happens is like the file would be restored to its repo stage so which is like your uh compare it with the version so it will mostly remain unchanged so there's no no change so contents are identical so it'll restore it to its current repo version so this particular revision would be restored so how do you restore that file so now you started working you checked out master and you started working out on those files you finished everything and you want to continue your work okay on your uh stash branch you're going to check out check it out again okay so after you do that there's something called unstash uh go to get where's that unstash changes uh so this is one thing so this is like your stash that you saved you can view you can view what is the file that you are looking at what are the difference that you want to apply to so our changes are safe and sound here now just click on this and click on apply stash now what happens is like just copy paste now all of your code is restored and you can continue working on it so rather than doing a backup like copying pasting etc or run the risk of losing your existing code and if you want to quickly do a bug fix and then come back to your dev work you can either check in this to your public repo or your remote repo and then come back or this is another option rather than making your branch advanced by an index your head might be changed an unnecessary comment which is uh you might be in the middle of something so in those scenarios you can use this feature called stash so that's stash for now okay so now we've seen stash as well so now let's quickly so we have done the stash branch so we push this branch so let's see on how to delete this so how do you delete a branch so you created a branch did some changes and now you think that these changes are not required at all so what you need to do is like delete it uh delete a branch for deleting a branch you should switch to another branch say master okay so go to another branch and then go here and click on stash branch then you will get this delete branch okay so this option will be coming here if you if you observe that if you go ahead and check out stash branch again and if you go and see if a delete branch comes and it wouldn't come in so if you're if you're pointed or if you're working on your current branch that branch cannot be deleted you need to switch to another branch check it out and then you can delete your current branch so now this local branch has been deleted okay and you can also delete the remote branch like this so you can either click that option or you miss that clicking option once the local branch is deleted you can always go here and click on this and delete it okay so there are two ways in which you can delete a remote branch once after you delete your local branch the other after you go into this jit branches window okay so now we've seen how to delete a branch as well so now let's look at the other use case like the merging from the master branch into a current branch say i'm working on this feature branch called feature one in the evening i've done some code but not on this say like i've just modified the pawn.xml and i've kept it for checking in but say like another change has come in through the master say like someone like stream to learn has checked in through the um raising a pull request format so he sent this particular change into the master branch so how do we get this latest into our feature branch and continue with our changes and then we continue to commit our changes and raise a pull request so let's quickly have a look at it okay so our branch is at this head which is feature one so if you see this our head is here okay now what we need to do is like we need to merge the master into our branch so how do we do that we need to go to this option here click on master and look at this option merge into current our current branch is feature 1 we go to master click on this and we see the changes have come in so the changes from the master has been merged into our feature branch so just for verification we'll just do a fetch again so no changes here all the changes have been fetched in okay and we'll quickly check if there is any local changes there seems to be no local changes but only our pawn.xml so what we need to do is like we can just add our bom.xml okay add pawn.xml and commit our changes so we've taken the latest so in this way if we do it in this way we'll not here we will not have any merge conflicts during our pr our pull request so we've raised this we've created this branch we've made a check in so after committing the file we need to push the branch to remote okay so we need to push it to remote if you see so the update from the master will be here as well so the update from the master will be here as well so all all the comments that are as part of the stream to learns comments will be coming in as part of this merge request so what we need to do is like once we do a push all of our changes will go to our feature okay we'll raise we'll refresh the page okay so now we see our commit so the branch now will come and sync with the master and if you go to the pull request if you go to the pull request you can go ahead and raise a new pull request now compare it with the base master this is our new feature branch we'll just see that there is only one commit so this comment has palm.xml so this bomb.xml is going to have this value and we are going to create a pull request only one file has been added and we create it and we can quickly do a squash and merge so once we do a squash and merge the palm.xml will be added to our master so now if you do an update here there is a log so go here to an update if you see this is a feature branch now the master is merged with only one file so we didn't we didn't mess around with the changes that came in from stream to learn okay so now we were able to merge the masters changes into our branch and do a change with respect to this so we'll go into another use case okay so now we managed to check in a file which didn't have changes from both the persons who were working okay so now uh what i'm going to do is like i'm going to ask stream to learn to make a change into master okay i'm going to ask him to make a change in master and i'll be working on it parallelly okay so let me quickly add some changes here so i'm going to ask him to make some changes so my changes are going to be only these things okay so what i'm going to do is a stream to learn to add three more lines of code here and put it into master and i'm going to continue working on my feature branch let's see how things go and if the merge request happens automatically so let's uh stream to learn to make some changes so let's go here so it says open but refresh hasn't happened okay perfect so now let's ask him to go ahead and make a change here yeah check in from stream to learn change one two four five six okay so let's say he followed the same process he followed the process of raising a pr and committing the changes now he has committed to the master okay so imagine that he's done it via the master okay okay so like we're going to create a pull request okay and there is no conflicts so since he is not the owner of the repo he will not be allowed to do the pull request or approve the pull request i'll again go to the pull request here i'll go here and now i'll get the option of squashing and merging it okay so now i've got the squash and merge so now things are fine so all things are merged from stream to learn into the master let's do a refresh here so stream to learn has worked here okay so he has played with this file so he has added two more lines okay so now imagine that i have not taken the latest i have not merged into the merged master into my feature branch now okay even though i merged it here and added the pom.xml and these two are in sync i have not done this process here okay now i start working on this code here this is feature one i don't have this change as you see i don't have this change one two so let me put change ashwin shakti and i'll put another okay so let's put our own code here change one to four five six ashwin shakti okay so these are the things that confuse people who start up with kit okay seven eight nine i'm going slow use case by use case just for our understanding so now i've changed this okay and i am in this branch i am in this branch i need to commit this change let's go to the local changes okay we'll see what is the unchanged one so these are the ones that are differing from my feature branch's head so these will be allowed to be committed so let me go ahead and commit it into my feature branch so now i've committed the change and i'm going to push it to my remote repository so if it's not pushed if it's not pushed it will show this arrow if the master is not updated it's going to show this arrow let's quickly push it to the master so my change has been pushed so now if you see that arrow would be gone so i think master is just asking us to update even though we've done it here so now let's look at the log so now you see our dev class is here where it's not having these changes okay so my seven eight nine has gone in so where is the seven eight nine so this seven eight nine i should have used another comment let's let's edit the image or comment message so this is a way to edit the commit message okay just go to the i accidentally committed with the same message so this is another use case so we'll just add say adding new line from feature one okay so now i added a new line so this is going to be message changed okay so this has to be pushed it's asking us to merge so now it's going to be merged and the changes are pushed so we'll see the comment so this was the comment that was done we'll quickly go here and see in our feature branch what is the state so now our changes are there okay so our changes are there okay just ignore the alerts that came about with the feature branch okay so now our comments now if you go to git go to the log see this part here so it has merged our changes are present okay now what i need to do is like i'm going to raise a pr i'm going to raise a pr with my changes from feature 1 but i have not taken the latest from master which is actually this one 456 which is actually changes from stream to learn so now what i'm going to do is raise a pr from feature new pull request base master this is feature one okay so i'm going to add all of this create a pull request now you got this error can't automatically merge you see why is this problem because we didn't take the latest so that's the reason you should be taking the latest you go ahead and create the pull request you go ahead and create a pull request but it will still show up these issues now you need to resolve the conflicts now it will ask us to merge these things okay you need to verify which are the changes you need okay so now you need to go here remove this so change from stream to learn has to be kept so this is a change from our end so stream to lens changed changes are there our changes are there okay so now just keep it as mark as a result commit merge so now what happens is like we'll be allowed to squash and merge so this is the exact use case that comes in broad so how do you merge from a feature branch or from a master into your feature branch and sometimes people do changes simultaneously where will be having these kind of issues okay so if you want we can look at this use case again so what happened was like now we'll do a refresh now if you see feature and master are in sync now if you go to now our classes here is like having like this seven eight nine now if i go here it's going to have both one two four five six seven eight nine and one two all of the four lines okay so now let's quickly merge into a feature branch merge into current recorder so now if you see again the confusion would have taken place you need to clear out the confusion make sure that all of the lines are present and do a comment this is the process you should have followed at the start before we raise the pull request you got it so now you need to merge it and do a comment so to avoid this there's an option called rebase since we already merged this using the front end we are we already merged it using the web page so there we did the merge using the utility given that if you want to avoid that what you need to do is like you need to click on this so we'll do we'll do a reset we'll do a reset of it do roll back so now our changes are pertaining to this even though it is there feature is still here so now you need to merge with this so how do you do that so what you need to do if we we need to make sure these changes are in our local okay so we need to go to master and update okay we've updated the branch now we'll rebase now we'll do a rebase merge or rebase current onto selected yeah so now we have an option of merging the master so the master we see here has all of the changes so our change doesn't have stream to learn changes one two four five six we need to accept value here we need to accept the right you can either click on accept right or use the arrows like this so we don't need these values we'll just do this change like this and click on apply or you can do undo and click on accept write so all of the changes would be there so we've accepted all of the changes from master so now we've got all of the features rebase from master into our feature now if we refresh the values from the master have been re based on feature so all of the changes would be here so now if you make any changes and do a comment let's do a comment here saying that after after rebase now only this should differ from a master okay so we'll do a commit so we've committed our changes only these two should be going and now so now we'll see we want to push it so now all of the changes have been merged and pushed let's go ahead and check it here now we need to go ahead and raise another pull request so now we pushed let's go to the comments we'll see okay sorry so we are referring to the master branch sorry about that we'll go to feature go to pull request new pull request base and feature so now all the changes from the master will be here okay and now you see the change only our current change would be reflecting okay so now if we do a squash and merge and do an update here go to log to an update perfect so now the update from feature and master has taken place and we have updated now both feature and master are in sync now so this is how the entire life cycle of merge delete etc ebays etc work so hopefully you would have understood the situation of a rebase so why a rebase is needed so that pretty much covers all the life cycles of what you need to perform using a get repository you can revisit this repository or this video once again so now we've done all of the changes okay and we've committed the changes to master okay say like you want to have a version or a checkpoint here say you're going to release this to a customer in customer what do you do you do a tag and do a release okay so you need to create something called as a tag here after that you'll be able to do a release okay so as it says releases are powered by tagging specific points of history in a repository they have great for marking release points like v1.0 we'll use the same thing as a tag we'll do release hyphen v dot v1.0 okay we'll go to master check out master okay so we will do create tag uh we'll make it as release iphone v1.0 so now we've created a tag we need to push it to the remote we'll go to master push it and here you need to check this keep it as all and push it so once you do that your repository would be pushed your tag has been pushed to origin now we'll quickly go here since we didn't see any tags here we'll quickly see a tag here cool so now we've made a first release so after doing the full three cycle of the changes in our product we are ready to do our first milestone so what we need to do is like we need to go here after the tag has been pushed check all whether all of the features are there and go to releases and click on drafter new release okay so you can either go ahead and click on these options uh tag a new version target master using this approach or follow the approach i told you you can put the tag version here and do it or the easier approach is to create the tag using intellij go here click on the three dots here click on create release and here your tag has already been marked and we can put release version e 1.0 learning kit so this is how you release a product okay so all of this can be taken care using jenkins and continuous integration etc but this is a very good way of releasing a tag okay so you can add all of the use cases like any test cases you've done any sonar cube matrix all of this can be included here what it does is it will create a zip version of your whole file structure and keep it as a reference so that in case something runs bad or if you want a reward this is a checkpoint i'll go ahead and publish this release now you see i've released the product and it has a source code that can be downloaded so it can be downloaded okay so this is a first major release and you can always go ahead and delete it or modify it but it's a way of checkpointing so i guess we've covered most of the points that i wanted to cover today so i've done it in using the front end okay so if you want to still keep track of the logs or the back end you can always click on the console okay so the console would always be keeping track of all of the commands that are executed okay so it's going to push it's going to check out it's going to fetch it's going to fast again add push stash so all of the commands can be found here so i've given you an easier option okay so i've given you an easier option of looking ahead using the log and doing all of these operations the entire life cycle of a jet process in a production environment has been covered here so right from initializing a git repository then we added some files to the git repository we collaborated with another user then we made sure that a pull request had been raised or we reviewed some other person's code we added some comments then we actually approved the pull request we made sure that the pull request got merged and went into the head of the master then we played around with another feature branch made sure that it didn't conflict it had conflicts then resolve those conflicts did a rebase and then we worked on stashes then we did a delete branch and then finally after all of this process was successful we did a tag of the release or tag of the branch so after the tagging was done we were able to go ahead and do a release so a release is done to make sure that the zipped version of all of the code is executed or it can be shared with any other person so if you have a mail configured if you have an email configured to your github a release would be sent to your email okay so that that's how good a release is so hopefully you like my videos please keep liking my videos and subscribe to my channel thanks for watching please add your valuable comments as well if in case i missed anything as part of the life cycle and if you want anything else to be covered it will be awesome for me so that i can put in another part 2 version of this video i tried my best to cover all of the use cases that are possible using multiple users just point out if anything was missed or anything was wrongly interpreted in comments waiting for your review guys thank you signing off ashwin please keep subscribing thanks again bye
Info
Channel: Stream2Learn
Views: 14,241
Rating: undefined out of 5
Keywords: #git, #java, #intellij, #tutorial, #beginners, #learntocode, #versioncontrol, #codeversion, #learntogit, #gittutorial, #gitbasics, #rebase, #merge, #stash, #codingin4k, #4k
Id: HfYZvcP0Muo
Channel Id: undefined
Length: 60min 59sec (3659 seconds)
Published: Sun Aug 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.