Storing file revisions with Git commit
We have initialized a new repository for our project. Now we will learn how to store file modifications using git add
and git commit
.
Getting ready
Make sure you have initialized a new git repository and created sample files under your project directory. Follow the previous recipes to get more details.
How to do it…
Now that we have a new repo initialized for our project, let's go ahead and check in our files.
- Before we add any files, simply check the current status of the repo with the
git status
command. This should list all the files under theUntracked files
list, as follows:$ git status
As shown by
git status
, none of our files are being tracked byGit
. We need to add those files before Git tracks any changes to them. - Let's add all the files to the tracking list with
git add
:$ git add .
This command does not create any output, but stages all untracked files to be added to the repo. The symbol (
.
) specifies the current directory and...