Resolve merge conflict during git rebase

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so in this tutorial I'm going to show you how to resolve much conflict when you see a much conflict during a deep rebase right now I'm going to create a new repository named es test and I'm going to clone it to my local doing de pecheur I'll do git clone okay so I'm going to change the directory to test clear everything and I'm going to create a text file I'm going to add ten dot txt and as it says right now I'm going to add it to a staging area and then I'm going to call me 10th St is crated and right now I will be using this Elias to visualize things better okay so I'm going to do a git push origin master all right so what I'm going to do right now is to modify the ten dot txt in the remote repository click on edit and I'm going to add something like remote and I'm going to put the comment message as remote as well commit the changes and I will do the same at my local I'm going to make some changes on a tender tasty I'm going to call your local save and as it okay so I'm going to add time dot txt and going to commit my tender TST I'm sorry click on me negative m1 local all right I'll clear everything and right now if you're I do graph so you can see your call me your local come is one commit the hit of origin master so if you do a git push origin master you're not going to be able to push it because there are some changes on the remote that you do not have locally so I'm going to do get stash or gene so let's say let's say if I'm going to do a git rebase origin master and you can see it says that we have a merge conflict in the tender tasty because at the second line we have some changes on the remote and we had also some changes on the local side so right now it's a in rebasing state so if you this problem what you can do is that you can actually fold just follow the what the gates say it says that you have to resolve all conflicts manually first so actually you can see let's say you if you have many files right you don't know that which files you have conflict you can actually use this command so I'm going to so if you type conflict right now right it shows the name of the files which has conflict so I'm going to make changes on ten dot txt right now I'm going to take both changes one is from the remote and you can delete other things because you don't need it and these are the changes I'm going to click in do mine time no txt control X Y the safe enter as it right now it says that after you resolve the conflict right you have to mark them as resolve brief get add ok so if you do get status you can use get at ten dot txt so if you do get status again you can see it's in the staging area so what I'm going to do now is that I can do a git rebase continuum if you do graph here so you can see that right now your local master and your origin master they have been diverged all right so right now if you do git rebase negative negative continue and since you have resolved the conflict it will help you to do the rebase and you do a graphic game right now you can see right now the base of the master right now is being moved on top of the base of this coming which is a five three six nine eight seven and the commit ID of this local master is being changed to a totally new and highly new coming okay so you can see right now the whole history is in one straight line and it's a lot nicer so if you compare if you resolve conflict and do a git merge you have two lines and then they are mush into one single point which is your much commie so the history do not be a single straight line and you'll be nonlinear compared to if you use a git rebase you have a linear history which is a lot better okay so right now if let's say if you want to change the commit message what you can do is that git commit negative negative amen it seems you have incorporating the changes of the remote and local I want to change my comment message okay I can type git commit negative negative a man and I'm going type I to insert I'm going to delete the commit message previously I've entered I'm going to say incorporating the changes from local and remote alright so after Escape key and then semicolon WQ okay so i if you do graph and you can see that the commit message has changed and I'm going to do a git push origin master so right now if you do graphic being you can see your origin master is in sync with the local master and you go to the page and you can see right now there's a for coming and the latest come is incorporating the changes from local or remote and you can see there's a remote and that's a local alright so this what we want is how we solve the merge conflict when we are using a git rebase to match the changes from the remote into the local so thank you so much for watching
Info
Channel: Steven Lee
Views: 9,256
Rating: 4.8113208 out of 5
Keywords:
Id: RGtwxYqkkas
Channel Id: undefined
Length: 6min 25sec (385 seconds)
Published: Sun May 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.