Introduction to Git (2) - Adding a New File
Now create a file that Git doesn’t know about. With your favorite editor, create the file hello.py, which has just a print statement in it.
# hello.py
print('hello Git!')
If you run git status again, you’ll see a different result:
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.py
nothing added to commit but untracked files present (use "git add" to track)
Now Git sees the new file and tells you that it’s untracked. That’s just Git’s way of saying that the file is not part of the repo and is not under version control. We can fix that by adding the file to Git. Use the git add command to make that happen:
$ git add hello.py
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: hello.py