tags:

views:

4710

answers:

3

The command git add [--all|-A] appears to be identical to git add .. Is this correct? If not, how do they differ?

A: 

Poster above's answer is best. I edited mine out.

Ian Kelling
@Ian Kelling, then delete it if you so wish.
Simucal
+46  A: 
Charles Bailey
@Charles Thanks for this detailed answer. I have edited your post adding sample output and summary.
takeshin
@takeshin: I already had a one-line summary as the first paragraph and then a summary paragraph on what each form does. What does (for example) "without deleted" add? It's so brief that it could be interpreted as "without changes that delete lines" which isn't very clear. I had a script that the user could work through to try out the various combinations. You've intermingled commands to run and output to expect in the the same box which I think is more confusing than what I originally had. You've also only supplied the output to some commands. Was my answer really so bad before?
Charles Bailey
@Charles The answer was excellent. I just had to run the code to see the output, so I thought that other may save some time seeing the output without running the code. I added the summary for the output above, which uses keywords: `deleted`, `new` and `modified` to be clear. No offence. Feel free to roll back the changes :)
takeshin
A: 

So from Charles instructions above, after testing my proposed understanding would be as follow:

For the next commit,
$ git add . # add to index only files created or modified and not those deleted
$ git add -u # add to index only files modified or deleted and not those created
$ git add -A # do both operation at once, add to index all files

This link might also be helpfull to understand in what situation those commands may be applied: http://www.geekgumbo.com/2010/05/16/removing-deleted-files-from-your-git-working-directory/

Richard