DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
No commits yet

Untracked files:
(use "git add <file>..." to include in what
will be committed)

newfile
nothing added to commit but untracked files
present (use "git add"
to track)

Git is helpful and tells you that it sees the new file, but
you need to do something else to enable version control
and let Git know to start tracking it.


Adding and Removing Files


When you are finished making changes to files, you can
add them to the index. Git knows to then start tracking
changes for the files you identified. You can use the
following commands to add files to an index:


git add. or -A: Adds everything in the entire local workspace.
git add (filename): Adds a single file.

The git add command adds all new or deleted files and
directories to the index. Why select an individual file
instead of everything with the. or -A option? It comes
down to being specific about what you are changing and
adding to the index. If you accidently make a change to
another file and commit everything, you might
unintentionally make a change to your code and then
have to do a rollback. Being specific is always safest. You
can use the following commands to add the file newfile to
the Git index (in a process known as staging):


Click here to view code image


# git add newfile
# git status
On branch master
Free download pdf