Introduction to Git (2) - Adding a New File

in #python-dev4 years ago

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
Sort:  

Plagiarism is the copying & pasting of others work without giving credit to the original author or artist. Plagiarized posts are considered fraud and violate the intellectual property rights of the original creator.

Fraud is discouraged by the community and may result in the account being Blacklisted.

Good tutorial, very easy to follow. looking forward to see more post on.