What is going on, ladies and gentlemen, I hope you're doing well in this video, we are going to expand
our knowledge and talk about one interesting operation that we haven't spoke of probably until now.
We are going to take a look at how we can take a file.
OK, just a file, one of these, which is one step before the actual commit, one state before the
actual commit right.
In the staging area.
And we are going to modify the content of these file in the working directory.
OK, so simply to modify its content into to understand what will actually happen in our five states
diagram.
So that's very important video.
Stay focused because here we go.
OK.
It's very important to be very, very focused here.
Guys, I'm going to show you that although we've seen like a file can change from one state to another,
we are going to see that something is not entirely true.
And there is no just one state for a file.
We can see that there may be times that we need like to think even further and to understand it a little
bit more about what's going on behind the scenes.
That's.
Actually, can can be considered to be a little bit advanced, OK, because this understanding that
you are going to get in this video and I think that also in the next will let you understand things
in more depth and prepare you for more advanced commands and also for additional things that are not
covered in these course.
But if you're working in a company or you will have your own complicated project, it may be of great
use to you.
So let's start.
And I think that we should start with a quick reminder.
OK, let's call let's recall our status get status that we've used so far.
And basically we have two files do files in the staging area.
OK, we have two files in the staged area.
Both of them got there from other states.
OK, so one was from untracked.
The second was from tracked and changed and not changed and so on and so forth.
Everything we've covered in the previous videos, but never mind about it right now because that's something
we've covered until now.
But now we want to move a step further.
And what we want to check right now is what will happen before making any actual snapshots of the staged
files.
Right.
Because now these files, these, let's say contents of the files are now staged, then changes to be
committed.
OK, so what will happen if we decide to modify one of these files?
And let's say that we wanted to modify the second file of this good night.
Why OK, currently and has the content of print, good night print and sweet dreams.
OK, maybe we found some bug that we immediately needed to fix or any other minor change that we have
to make were to add.
OK, so in this case, we take these file and let's say add one new line.
Let's say we simply add to the file some additional printing message of don't forget that you have to
wake up tomorrow at seven a.m..
OK.
Some additional printing message, something like that.
Nothing complicated.
And now once you've completed your changes, this new line, this edition of the new line has been made.
And the main question you should be asking yourselves this point is what will happen to the file itself?
OK, how is it going to treat and feel and see these files?
Will the file in the staging area be modified OK with this new content or maybe some other file will
get modified?
So what do you think, guys?
Doing a couple of moments, think about the solution and try to come up with a reasonable explanation
into you.
Like, don't don't pause this video for at least two or three minutes.
Think about it.
What will happen?
We have a file in the staging area these.
Good night.
That Bill White has had a previous content of that was like this.
Now, we added this new line print tomorrow, 7:00 a.m. What will happen?
What will happen?
How git system, our target version control system.
How is it going to look at this particular situation that happened?
Will the file in this staging area, in this index, will it be changed?
Will something else be changed?
Maybe we haven't specified everything so far.
So take a couple of moments and.
Once you're done, let's proceed.
So to answer this, let's simply take another look at our code, so previously we used the status and
that what it showed us now after these step, we've modified the file and now we use git status once
again after modifying the file, OK?
Either it was using notepad or a VM or whatever.
It doesn't really matter.
Right.
But what's interesting for us to see right now is this git status command.
This simply tells us how Gett sees the changes we've just made and what we can see here is very, very
strange.
OK, I mean, previously the status in this video and also a video in the previous video and so on,
usually the gets that is made some some kind of sense.
But now, once we've changed the file simply, I can't understand what's going on here.
OK.
The file is listed as both states state.
OK, so there is a stage state changes to be committed right in the staging area and also in the unstaged
on stage, right on stage stage when it has been simply modified.
OK, so changes not staged for comment.
And one question that you should be asking yourselves and also that you should be asking me is how can
a file be in two different states at one of the same time?
So that's very interesting, very interesting and very important to to understand, because that's the
same file it is in two different states kind of simultaneously.
So let's try to figure out what's going on here and talk about it in depth and prepare you for more
complicated situations just like this one and also for more complicated commands and so on and so forth.
So we have staged the file previously and added it to the staging area in our good night file.
Contained some ready content as part of it.
Right.
It was that was the previous content in the staging area, right.
That's the previous content in the staging area.
That's the content.
That's the staging area.
And it already had some great content.
Now, this content.
OK.
It was kind of documented and prepared for this snapshot.
OK.
So basically it means that previously when we used the Get Ad Command previously when the file was just
like this and we use the get add command to add the file to the staging area, then in this case, Gaete
has taken the file as these as it was in that particular moment with this given content and staged it.
OK, is that clear?
So this file in there is currently at the staging area.
OK, this particular file should not get affected by the optional new modifications and additions and
revisions and whatsoever you may do in your working directory.
So totally different things, OK.
You see the difference, right?
There are basically two revisions of the file.
It's two different places.
One place is at the staging area with this fixed or documented content.
In the other one is the in the on-Stage Arya ok in it was modified in the in the working directory.
This line has been added.
So kind of two different revisions of the file are having different states.
One of the staging area that cannot be affected in the second one which we've modified, is in the working
directorate and it can also get can see that this particular file has been changed.
Who so awesome.
I hope that things are getting a little bit more clear to you, but I think that this concept is not
the easiest one to grasp at first.
But I think that throughout the course and throughout solving examples and seeing different additional
videos, even if it's not clear a hundred percent now, things will be more clear as we all keep on
moving forward.
So no worries, guys.
Now, let's take a look.
Also, once again, it hit our workflow diagram, which really helps us a lot, I think.
And the file that is already in the staging area.
Here it is the good night that p why the python file that simply prints good night and sweet dreams.
It remains the same.
Ready to be committed.
OK, so that was kind of a snapshot and that's it.
And it simply means that if you would have committed now, OK, if you've made the commit command,
then the exact file you've added to the staging area.
OK, not including the further changes, not including the changes we've just made, then these staged
file will would have been documented as part of the snapshot.
So it will go like to the fifth state.
OK, so I think that's to the fifth.
They do actually do that repository to be to be part of the database.
So I hope that makes sense to you.
And the version of the modified file in the working directory would not have been documented since its
changes were not even staged for comment.
So once again, it changes these file changes that these new lines were not even staged for commit.
So that's basically what happens here behind the scenes.
OK, we kind of have to two states of the file at one at the same time.
And that kind of makes sense, right, guys?
Because, I mean, we said that we should add a file to the staging area once we know that we've made
all the changes we wanted to do as part of the next commit.
And there is probably no reason to modify the file prior its associated commit.
And that's super important to understand.
So if you take a look at the five states diagram we've used of the five states diagram we've used so
far, then it's going to look like the good night will actually have two additions in two different
states.
All right, guys, and if you should and if you would like to add the additional changes you've just
made before making this snapshot, because you know that these particular changes, I don't know, like
it's very mandatory that they should be a part of the next snapshot.
OK, so if these changes, it's super mandatory and it's very important that these changes will be part
of the next snapshot in not only these part to be these code, to be part of the next snapshot.
Then in this case, what you should do is simply use of a Guitard command.
OK, the get ad of the file itself and it will also modify the file in the staging area, adding also
this additional this additional revision additions that you've just made.
And now if you will commit it, you will commit the whole new document, the whole new data in the commit
on command.
So once again, two options before and after making the comment, before and after making the decisions,
I hope that's clear.
Previously we said that if at this date, at this stage, when we have one file here at the staging
area with one on text, with one content and also another file that is not staged, then in this case,
if we have used the get go, it will simply go like taking this file and put it in the repository database.
But if we want to document the changes also done here in the next commit, then simply use again, get
add and it will take these changes.
Add them to here.
And the new file that will be created will be something like that.
And in this case, now, if you do commit, you will put in their database repository of these files.
All of this information.
So this is it.
And I hope that's clear to you guys.
I think that in this video, we've covered some pretty decent information understanding that a file
can be more than just in one state.
And what happens if you modify a file when it's still in the staging area hasn't been committed yet,
and what will happen behind the scenes and this information, I'm sure about it, will help you a lot
when you will come to two different situations.
So, yeah, guys, very good job.
Keep on practicing.
Keep on writing notes.
I'm not sure I can create.
I mean, I don't know, like a documented file, a summarized file for this kind of explanation, because
I think that it will be really hard to put it in words.
I think that this visualization demonstrates everything precisely.
And I think that maybe you should write your own notes down and to like to create some summarized version
for yourself to explain what happens when, where, how and why.
And here this is for this video.
My name is Vlad.
This is Alphatech, and we are getting technology better.
So until next time, I'll see you then.