I was in the past using this Git command for my files:
add --update :/
as someone told me this was the best way to pick up all the files that had been added, deleted and updated.
However after reading: Difference between "git add -A" and "git add ."
I think maybe I should be using git add -A
Can someone tell me if there's a difference and what git add --update :/
actually does?
git add. The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn't really affect the repository in any significant way—changes are not actually recorded until you run git commit .
The difference lies in which files get added. git add -A command will add all modified and untracked files in the entire repository. Whereas git add . will only add modified and untracked files in the current directory and any sub-directories. If you are at the root of the repo, they have the same effect.
But, git add could also be used like: Create a branch: git branch update-readme. Checkout to that branch: git checkout update-readme. Change a file or files.
git add --update :/
will update or remove previously tracked files from the entire working tree. It will not add new files.
git add -A
will also update, remove previously tracked files, but it will also add new files. As this command doesn't have the explicit pathspec of :/
that your update command does, depending on your version of git, this may be for all files in the entire working tree, or it may be for the current directory and all subfolders and files.
For more info, the docs for git add can be found: http://git-scm.com/docs/git-add
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