Adds
index.html
to staging area
git add index.html
Adds
any html file
to staging area
git add *.html
Adds several files to staging area
git add index.html another.html index.php
Adds modified and deleted files only
git add -u  /  git add --update
Adds modified and new files only (but not new files without names)
git add *
Adds all the changes - modified, new and deleted files (
-A
is a short handhand notation for
--all
)
git add .  /  git add --all  /  git add -A
Adds all files including files with no names (ignores deleted files)
git add . --no-all  / git add . --ignore-removal
If we want to commit only part of changes of the same file
--patch
or
-p
is used
git add --patch   /   git add -p
Possible answers for the command:
y
stage this hunk for the next commit
n
do not stage this hunk for the next commit
q
quit; do not stage this hunk or any of the remaining hunks
a
stage this hunk and all later hunks in the file
d
do not stage this hunk or any of the later hunks in the file ... The complete list of the possible answers is on the link of the note
by Valeri Tandilashvili
4 years ago
Git
Git Tutorial - Learn Command-line Git & GitHub
1
Pro tip: use ```triple backticks around text``` to write in code fences