Git New Files

Git New Files

Git Adding New Files

let’s add some files, or create a new file using a text editor. Then save or move it to the folder that was just created.

For this example, let’s use a simple HTML file like this:

Example:

				
					<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello world!</h1>
<p>This is the first file in my new Git Repo.</p>
</body>
</html>
				
			

Now save this as index.html

Return to the terminal and list the files in the current working directory:

[user @localhost] ls index.html

ls list the files in the directory.

Then, check the Git status and see if it is a part of the repo:

[user @localhost] git status

On branch master

No commits

Untracked files:

(use “git add …” to include in what will be committed)

index.html

nothing added to commit but untracked files present .

Git knows the file but has not added it to the repository.

Files in the Git repository folder can be in one of the two states mentioned below:

Tracked – files that Git knows about and are added to the repository

Untracked – files that are in the working directory, but are not added to the repository