How can you add files to Git?
Use the git add command. It moves the changes to the staging area, and only staged changes go in the next commit.
Terminal output
$ git add index.html
$ git add *.html
$ git add .
$ git status -s
A about.html
A index.html
A style.css
| Command | What it adds |
|---|---|
git add file1 file2 | Only the named files (separate with a space, not a comma) |
git add . | All new and changed files in the current folder |
git add -A | All changes in the whole repository |
git add -u | Only already tracked files (changed and deleted) |
git add -p | Choose the parts of a file one by one |
See Git Add.
Learn more about the similar topics:
| Tutorials |
|---|
| Git Init |
| Git Status |
| Git Add |
| Git Commit |
| Git Log |
| Git Diff |
| Git Ignore (.gitignore) |