Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>This answer only applies to <strong>Git version 1.x</strong>. For Git version 2.x, see other answers.</em></p> <hr> <p><strong>Summary:</strong></p> <ul> <li><p><code>git add -A</code> stages <strong>all changes</strong></p></li> <li><p><code>git add .</code> stages new files and modifications, <strong>without deletions</strong></p></li> <li><p><code>git add -u</code> stages modifications and deletions, <strong>without new files</strong></p></li> </ul> <hr> <p><strong>Detail:</strong></p> <p><code>git add -A</code> is equivalent to <code>git add .; git add -u</code>.</p> <p>The important point about <code>git add .</code> is that it looks at the working tree and adds all those paths to the staged changes if they are either changed or are new and not ignored, it does not stage any 'rm' actions.</p> <p><code>git add -u</code> looks at all the <em>already</em> tracked files and stages the changes to those files if they are different or if they have been removed. It does not add any new files, it only stages changes to already tracked files.</p> <p><code>git add -A</code> is a handy shortcut for doing both of those.</p> <p>You can test the differences out with something like this (note that for Git version 2.x your output for <code>git add .</code> <code>git status</code> <strong>will</strong> be different):</p> <pre class="lang-sh prettyprint-override"><code>git init echo Change me &gt; change-me echo Delete me &gt; delete-me git add change-me delete-me git commit -m initial echo OK &gt;&gt; change-me rm delete-me echo Add me &gt; add-me git status # Changed but not updated: # modified: change-me # deleted: delete-me # Untracked files: # add-me git add . git status # Changes to be committed: # new file: add-me # modified: change-me # Changed but not updated: # deleted: delete-me git reset git add -u git status # Changes to be committed: # modified: change-me # deleted: delete-me # Untracked files: # add-me git reset git add -A git status # Changes to be committed: # new file: add-me # modified: change-me # deleted: delete-me </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload