Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "git add -A" and "git add --update :/"?

Tags:

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?

like image 461
Alan2 Avatar asked Jan 26 '15 08:01

Alan2


People also ask

What does git add -- update do?

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 .

What is the difference between git add and?

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.

What are the two things that the git add command can do?

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.


1 Answers

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

like image 110
Charlie Avatar answered Sep 28 '22 04:09

Charlie