Let's start by adding a couple of files to our project. To do
that, we're gonna use the echo command. This is not a good
command, it's just a standard Unix or Linux command for
writing content to a file. So here we're gonna write hello to
file one dot txt. So here, I'm working with a txt file. Because
I don't want this course to be specific to people who know a
particular programming language like Python or JavaScript. What
I'm going to show you in terms of the workflow applies to any
programming languages. Okay? So we write hello to file one dot
txt. Good. Now let's execute this command one more time, and
change file one to file two. So now we have two files in our
project. Now look at this question mark here. That means
we have new files here that are not tracked by git, because the
first time you initialize a git repository in a directory, Git
is not going to automatically track your files. So if you have
1000 files in a project, you have to instruct Git to track
them. Okay. So here we go. run git status to see the status of
the working directory on the staging area. Take a look. So we
don't have any comments yet. We have untracked files, which are
file one and file two. They're indicated by red because they're
not in the staging area yet. To add these files to the staging
area, we use the git add command. Here we can list a
single file, like file one dot txt, or multiple files separated
by a space. We can also use patterns. So star dot txt, that
means all the files with a txt extension, we also have period,
which adds the entire directory recursively. But you have to be
a little bit careful with this. Because sometimes there are
files you don't want to add to your repository, perhaps large
files like large binary files or lock files, you don't want to
add this faster repository, because they increase the size
of your repository. I will show you how to ignore this files
later in this section. So just remember, add period adds the
entire directory recursively in this demo, I'm going to go with
this command, because we only have two files in this
directory, okay? Now our green indicator change to yellow,
which means we have stuff in the staging area that are ready to
be committed. So if we run git status again, look, we have two
new files, and they're indicated by green, which means they're in
the staging area. Now, let me show you something interesting.
I'm going to modify a file one. So once again, we're gonna use
the echo command to echo world. But here instead of one greater
than sign, I'm going to use two greater than signs, which means
a pet. So we're going to append world to file one dot txt. Now
let's run git status again, look what happened. We have two files
in the staging area, because they're indicated by green. But
we also have one modified file in our working directory. So you
might be asking, but hey, Marsh, didn't we already Add File one
to staging area? Yes, we did. But when you run the Add
command, get took a snapshot of file one And out of that
snapshot to the staging area. So here's the current situation. In
the staging area, we have the first version of file one, we
change this file after we added it to the staging area. So what
we currently have in our working directory is the second version
of this file. It has some changes that are not staged yet.
So back to the terminal. We run git add period or git add file
one dot txt one more time. Now look at the status of our
working directory. Both these files are in the staging area,
and we don't have any unstaged changes. So next, I'm going to
show you how to commit this snapshot to permanently store it
in our Git repository.