Hello, dear students in this class, and I'll teach you how you can update your local repository.
Today, I will explain to you why we need to update our local repository, how often we have to do that
and what commands we have to use.
Today, I prepared a special demo with the and flow in which I will show you commands that you are going
to use in most cases at your work.
I will tell you today, more and more to get fetch, get Merche, get pool commands.
Also, I will explain what does Fastforward mean.
We are going to learn a lot today.
Let's start first of all, let's answer the question why we have to update our local repository.
We have to update our local repository because we want to be sure that the codes that we created will
work with other the court as expected.
That is the most important reason of updating local repository as often as we can.
To what situations?
When you work on some task for one week or two weeks and when you need to merge your code with Master
Branch, you discover multiple conflicts in your code.
Today, I will show you command and real examples how you can update your local repository.
In previous lesson, you learned how to prepare people request and merge changes.
Now let's imagine that you successfully completed your previous task and you are about to start your
work on the new task.
Right now, in my local repository, I I'm on the task branch.
We already know that to start work on the new task and to separate code one from another, I have to
create a new branch.
Usually I want to create a new branch from the latest version of the source code.
So let me switch the master branch.
OK, I'm on the master branch, but do I have the latest version of my code here?
Let me navigate the SASE folder and check whether I have all the latest updates on this branch.
To navigate to the SRT folder, I have to type CGY SAAC.
OK, now let's list all the files else that shall and you see that we don't have this calculation service
here, why I'm on the Master Branch and we merged our changes with the master branch.
And the previous lesson, let's not confuse two things Master Branch and a region master branch.
And previous lesson when the merged request was called to the region master branch.
But we didn't merge, got into our master branch.
So what to do now?
Now we are going to learn a few commands, get fetch what is good for each command.
This command fetches all changes from the remote repository and put it in your local repository one
more time.
Important thing to mention here is that changes are not matched to your local branches.
So in case some comments in the region Master Branch exist, which a local repository is not aware of,
PFEG Command will save information about these changes in your local repository.
Let me press enter now.
Based on the log messages here, we can conclude that some changes were downloaded from the remote.
OK, probably now I have all the latest changes in my branch, including new file, discount calculation
service and all the latest changes from the Hello World File.
Let me check it one more time as well.
And again, I don't have any latest updates.
Why?
Because I have just downloaded information about these changes, but I didn't actually merge these changes
in the local branch.
Then what is the purpose of this command at all?
Imagine that you are working on the new changes and I don't want to merge latest code into your branch.
Do not break anything.
And you would like to know whether there are any changes in remote branch that are needed to be merged.
One more use case of using it for each command.
You can fetch changes while sitting in the office and the security VPN connection and you can merge
carefully your code later when you want while sitting on your cozy chair at your home.
But what if I am already at my home sitting on the couch?
What do I have to do now?
Now I have to merge these changes into my local branch, so I'm doing it.
Merge command gate.
Merge.
Awesome.
It looks like some changes have been merged with my master branch, I see Fastforward message here.
What does that mean?
And fast forward is what it does when you merge or a base against a branch that is simply ahead, the
one you have checked out.
That means there was no branches and that is the new value of the branch is a direct descendant of the
prior values.
So we had a region master branch that contains commands that are descendant of our previous master branch.
That's why we call such merging as fast forward now when we have merged the latest updates.
Let me check list of files and dash I'll command.
Wow.
Finally, I have this calculation service file in my file system.
That is the latest changes that have emerged in the remote repository.
Let me also check that update from Hello.
World File is also in place.
And previously we updated Hillenburg file and put extra lines in it.
Let me open this file in a text editor.
Nana.
Hello, World Dodgeville.
Nice.
I see only one characters outplays place here.
Let me exit now Ed by pressing control and simultaneously as described here.
Now, I want you to learn one more command that is good, but what is it command essentially getable
is a combination of two actions, PFEG and March.
So in case you want to fetch all changes from the remote repository and at the same time merge them
into the branch you have to use to command.
You're our demo today.
I want to show you real life scenarios that will happen with you on your workplace.
I want you not to learn just commands, but understand how you will use it while working with steam.
The name of this I prepared enter and flow that will show you the full scenario of what we learned so
far.
And I want you to be ready.
I want you to understand how team development is happening together.
We're going to imitate the next generation.
Imagine that we work on the implementation of virtual card in our online shop.
We are working on this task.
At the same time, developer number two works on the implementation of service that will provide functionality
of stock management.
Both engineers created the branch from the same revision, from the same command.
After that we created bool request and our changes were successfully merged.
And after that, developer number two created Pulu request and his request was successfully matched.
After that, we want to proceed with implementation of the next task product preservation, let's say.
But before start work on the new task, we have to pull all the latest changes to create the branch
with the latest updates.
And we have to execute get command.
Hope you you're not confused, but I want you to be prepared for the real life.
And this is the easiest real life scenario with only two developers.
Let them together, try to reproduce this in error.
So we are going to have next steps.
Developer one and two created branches and the changes after that, both engineers created peers that
were a match to the original master branch developer.
One post latest changes to start work on the new task.
Let's start.
Here is what we are going to do on our book.
Let's check the status of the master branch.
So it is up to date with the region masterbrand.
Cool.
Now let me create a new branch gates, which was option C G, a three zero to virtual car with which
to the new branch.
Let's imitate implementation of this task.
I will create a special directory called Card and Mkdir Card.
Here is a command that creates a directory.
Now let's navigate into this directory, S.A.G. cars.
Now let's create card management service file and we will pretend that there is a task implemented in
this file.
Darch Card Management Service Dajarra.
By the way, you can't push and commit only folder's if you want to set some basic folder structure
for your program.
There should be files in these folders.
OK, now let's add this to Sustagen yet at DOT and commit this change.
Yet commit dash and card management is implemented.
OK, we have a comment now let's push it to our region, yet push the our region keets three zero to
your troll car.
We'll create a pull request now.
Give me a few seconds here, you already know how to create a PR from the previous lesson.
PR is created what we want merge, they scored so far.
Meanwhile, developer number two created a separate branch to implement stock management.
OK, the same as here developer number two and the master branch and in the SLC directory, he wants
to start work on the new task and create a new branch Gates, which is option C, a three zero three
stock management.
Let's create a new folder in the SAAC directory mkdir stock.
Right now I create a directory in the search folder.
Let me navigate their C.G. stock.
OK, I'm here now.
Let me create a file Derg Stock Management Service Dot Java cuz that and this file to the staging area
get at dot and now let's commit yet command dash and stock management is implemented.
And let's push it to the remote, get push there for you, originally, a three zero three stock management.
Now I have to create a request for this change.
Let us manage to pull requests now.
And you see that quote in Monster is updated in caves during the new task, implementation you would
need is a correct management service or stock management service.
It is better for you to learn it earlier, because, first of all, probably you're going to use this
court or this court might break your court anyway.
It is better to have all changes from all developers on place in your local repository before start
any new work.
And finally, we return to the main branch and want to start work on the new task.
But right now, we have to make sure that we have the latest changes in the master branch before create
a new branch.
OK, what we have to do now, probably you would say get pfeg and get merge, but let's execute git
pull command.
Awesome, we pulled our changes and we are ready to work on the new task you see here, I pulled card
management service and stock management service and you see that we don't necessarily have to do get
pfeg.
And after that it gets merged.
Command get combines these two commands into one.
I can check my card and stock directory and find files there, you see.
We finished our practice exercise, Holmes's A Small Demo will help you to understand how we can use
it.
You're the game collaboration and new task implementation.
Let's recap what we have learned today.
Today, we learned why we need to update our local repository.
We also learned to get Fairgate marriage and get boogerman.
Now you know that you have to update your master branch before you start working on each new task.
You also understand the difference between a get FEG marriage and pull commence today.
So what is fastforward in it and at the end of the lesson I showed you and flow of how team development
is look like with the help of the get.
Thanks a lot for your attention.
See you in the next lesson.