Hello, yes, students, in this lesson, you learn what most conflicts are in simple words, I will
explain in one, much conflicts could appear together, will reproduce real life scenarios, merge conflict.
And what is even more interesting, I will tell you how to solve major conflicts together during the
drama.
We are going to solve much conflict that will appear during the pulling from the remote repository.
And as usual, let's together give a definition to the conflict.
The conflict is a specific event that takes place when it is unable to resolve differences in code between
two commits automatically.
This is a event which we can't avoid during the development in the team.
Usually it may happen when two developers change in the same line of code.
How it can be.
For example, imagine that in our project we have some web page and developer.
No one worked on the task to implement login button and added some styles.
She included these styles into our HTML page and developing a number to work on the task for implementing
carcel on the home page.
Engineer number two also had to do adjustments in the home page because he wanted to include his custom
styles and adjust page markup a bit.
First, Engineer pushed his code to his original branch.
He also created a pool request that was successfully merged.
But one second engineer tried to create a pool request.
He received an error that there are no conflicts.
Why?
Because two engineers and they did the same file home that each demo and most likely in the same lines
of code.
And you can't understand what version of code is the latest one and the proper one, yet can't match
this code automatically.
This situation is called much conflict.
What to do in this case?
In this case, conflict should be resolved manually.
Engineer number two has to pull all the latest changes into his branch, investigate where exactly this
conflict is appeared and resolve it by saying resolve it.
I mean change source code and create a command that will be approved to the gate that these changes
are created intentionally and well reviewed by some engineer after much conflict.
As a result, the file can be merged to the master branch.
So today we are going to review the example, how this much conflict is created and how to solve it.
Let's start to start with I'd like to inform you that for the sake of the demo before this lesson,
I created this home, the HTML file in the Web content directory.
Let's take a look at it.
As you can see, this is the simplest possible HTML file with an overall text in it, nothing special
to not lose focus from the goal of our lesson.
This file was created in the separate branch and merged with the remote repository.
You already know how to do that.
Now imagine the developer.
One wanted to create styles for login button and pop up on the homepage.
Let's create a new branch for that.
Yes, which was option C Geet three zero four login styling.
Just for the sake of example, let's imagine that we have some styles folder where Altius has files
should be stored for those who are not aware.
Files with the Texas extension are used for styling your elements on the HTML pages.
This stands for Cascadian Stylesheets.
OK, let me create Styles folder in my SAAC directory.
Mkdir Styles.
Now let's imagine that during the task implementation developer, no one created Neuters as file was
description of custom styles touch styles again nauseousness.
Also Injinoo number one adjusted Holmwood HTML file to include this style there to reproduce the steps
that I did in this lesson.
You can use any text or code editor you would like.
For the sake of the demo, I will use Nano text editor to save time on switching between different screens.
Let me open home e-mail file to adjusted nano web content slash hamdard HDMI.
Just to remind you, I always use that key for auto completion internal according to rules.
I can include TSF style on this page like this and the hat that I should put my link back with.
The path to the text file had a link rel stylesheet HSF double dot slash styles slash again not to assess
and clotheslined attack and had attack is closed.
This is not a tumultuous assess.
That's why I won't stop on the things I wrote.
But I would like to draw attention to the lines which we changed.
We changed line three, four and five.
Remember this.
This is important for understanding of the conflict topic.
I access this file and save it now.
Add everything to the staging area, create and commit and push it to the original branch.
Those are the things that we have already learned in the previous lessons.
Give me a few seconds here.
Get at not yet committed again and again yet Bush with option you originally a three zero for Logan
stylin.
Also, I can create pool requests, but the important thing right now is not to match your pool request.
Why we need to imitate case one.
Developer number two started implementation of his task without knowing about changes in the home.
Each team will understand.
Right now, let's pretend that we as the other engineer.
Let me let me get back to the massive branch and create new branch for my task from it gets which M.
Gates, which was option C, a three zero five homecourt.
So nice.
Now I have to create my own styles for Carasso.
Let me create file in styles directory take into account with each branch.
I don't have styles directory.
Here, let me show you this.
It is optional and you can see that Styles directory is not created yet on this branch.
Let me quickly created mkdir styles.
Now I can create miticides, file touch styles Carasso not to assess and now let me adjust home html
file.
None of content slash home dot HMO, I will put reference to my sister's file here.
At least, Carol Stylesheet, a triple double dose slash style slash carrousel, not Ceressus, and
close the attack.
Attack is also closed.
And you can notice that I changed lines number three, four and five, the same lines that as a developer
changed.
This is important.
Let me close and save this file.
I'm going to add all changes to the staging area.
Come in then and push to the remote repository.
Give me a few seconds here.
Get at DOT.
You'd commit option and carrousel on the home page.
Get push resorption you a region key, a three zero five home Carasso.
Now imagine that during implementation of the home Carasso task pool request for logging's talent was
matched by a technique.
Let me merge it.
OK, it is merged and nothing bad happened.
Now let me create a pool request for carrousel implementation.
First of all, I see here warning that this branch can't be automatically merged, but still I can create
a pull request.
And after I created a request, I see that my emerge button is disabled because of the conflicts you
can see in here that you can solve conflicts in the Web editor, while this can be an option in case
of the resolving of the small conflict.
This is not an option for the most cases.
Why?
Because of the few reasons.
Reason number one, most likely you have more complicated conflicts than we have now here.
And this is not convenient to change it in Web editor reason number two, after resolving conflicts,
you want to be sure that you didn't break anything for this?
You have to have your code on your local machine to run unit tests or integration tests on case HDMI
additon to open each HTML page to make sure that everything is OK with your markup.
So I will show you how you can solve conflicts on your local machine.
Let me get back to the Kit Bash.
I'm on my task home carrousel branch, as you can see here, to resolve the conflicts, I have to merge
a region master branch into the current branch.
You already know that.
Merge command, merge different branches.
But let me show you how you can merge remote branch into the current one yet pull a region master.
You also learned in previous lessons that pull command, merge changes into the branch.
And here you can see the message that there is a conflict in this file.
Automatic merge is failed.
Let resolve conflicts.
I have to open in any code ed file where I have conflicts.
For the sake of the demo.
I will use Nnenna Ed in this lesson now.
No map content egholm not HMO.
And here you can find different symbols that get added to our file.
That is how it shows the conflicts.
You already know that hat is a pointer to the place where you are currently in your working directory.
So here you can see our version of code.
We want to insert carrousel to assess and here changes from the master branch that were merged after
implementation of task by the world number one.
And check some of that comment.
We have to adjust file after some analysis.
I understood that in this particular case, I want to keep my changes and changes of developer.
No one will see that line.
Three and five were the same in two versions of code, but only in line number four was different.
We used different sets, file names here.
Let me add just markup accordingly.
After I'm done with changes, I exit and save this file.
Here in parentheses, you see mansions that I'm in the process of merging two branches also.
You can see that suggested to me to create the once conflicts are resolved.
Let's follow this advice and create a committee.
If you would check status with get status comment, then we would see that new file logging success
is already added to the staging area.
That's the one from the master branch where we don't have any conflicts.
And here is the file where we had a conflict.
Let me add it to the staging area yet at not now let's check status and we can see that all files are
in the staging area.
Now, let's create a climate gate comment.
I will skip the message now because for such cases get already stolen message for me, the message that
states that must branch is merged into the task branch.
Let's close this text editor and we can see that we successfully merged changes.
Now we need to update our branch in remote repository.
Let's push our changes.
Get Bush.
Now, let me refresh page with my pool request.
I can't rebase and merge, and I will explain why in the next lesson, but I can merge with creating
a new command.
And if you remember that in previous lesson I showed you different margined strategies and how to allow
different merging strategies here in the settings and the merge button section.
Congratulations yourself, your first merge conflict.
But unfortunately, we are not falling right now.
Best practices of keeping it historically.
Why?
Because first of all, we created separate committees during the merger and Origin Master Branch was
our task branch and right now we are under the risk to create one more committee for merging branches.
Can you imagine how our history tree will look like after all of this?
Your tax rate will be disappointed.
Just joking in the next lessons.
I will show you how to avoid this and how to keep your tax rate happy.
But still to understand the next lessons, you had to understand this lesson.
And why pull an origin master into your branch to resolve conflicts is not the best approach.
While this approach is still valid in some companies and in some development teams, that is not the
approach which I would approve in my development team and in my company.
Probably already aware that I am CEO of my own software development company.
And when I interviewed engineers, I paid extra attention to the experience of working with it, because
during the development of complex projects and cross-functional teams, these skills are very important.
I am going to create top notch software engineers from you during this course.
That's why I will run as a way to solve financial conflicts.
OK, and if we are good for the day, let's recap what we have learned today.
In this lesson, you learned what marriage conflicts are more over together, even we produce much conflict
in real life.
Example, you learned how to resolve marriage conflicts locally and how to manage a region must rush
into a task branch.
Thanks a lot for your attention.
See you in the next lesson.