Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
git add . stages the new files and modifications but not deletions.
To fix this error, either add the files causing the error to the staging area or ignore them using the . gitignore file.
Try:
git add -A
Warning: Starting with git 2.0 (mid 2013), this will always stage files on the whole working tree.
If you want to stage files under the current path of your working tree, you need to use:
git add -A .
Also see: Difference of git add -A
and git add .
Try
git add -u
The "u
" option stands for update. This will update the repo and actually delete files from the repo that you have deleted in your local copy.
git add -u [filename]
to stage a delete to just one file. Once pushed, the file will no longer be in the repo.
Alternatively,
git add -A .
is equivalent to
git add .
git add -u .
Note the extra '.' on git add -A
and git add -u
Warning: Starting with git 2.0 (mid 2013), this will always stage files on the whole working tree.
If you want to stage files under the current path of your working tree, you need to use:
git add -A .
Also see: Difference of git add -A
and git add .
The following answer only applies to Git version 1.x, but to Git version 2.x.
You want git add -A
:
git add -A
stages All;
git add .
stages new and modified, without deleted;
git add -u
stages modified and deleted, without new.
git add --all
or git add -A
or git add -A .
Stages All
git add .
Stages New & Modified But Without Deleted
git add -u
Stages Modified & Deleted But Without New
git commit -a
Means git add -u
And git commit -m "message"
After writing this command follow these steps:-
git add <list of files>
add specific file
git add *.txt
add all the txt files in current directory
git add docs/*/txt
add all txt files in docs directory
git add docs/
add all files in docs directory
git add "*.txt"
or git add '*.txt'
add all the files in the whole project
I'm not sure if it will add deleted files, but git add .
from the root will add all untracked files.
This is my alternative (in any bash):
$ git status -s|awk '{ print $2 }'|xargs git add
To reset
$ git status -s|awk '{ print $2 }'|xargs git reset HEAD
I authored the G2 project, a friendly environment for the command line git lover.
Please get the project from github - G2 https://github.com/orefalo/g2
It has a bunch of handy commands, one of them being exactly what your are looking for: freeze
freeze - Freeze all files in the repository (additions, deletions, modifications) to the staging area, thus staging that content for inclusion in the next commit. Also accept a specific path as parameter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With