The difference between git add-u and-a.

Source: Internet
Author: User
Git add-u: Add file modifications, delete files to staging area. git Add.: Changes the file, adds a new file to the staging area. Git add-a: File modification, file deletion, new file, add to Staging area.
-U is the meaning of update, only the local changes (including deletion and modification) are marked. has been tracedFILE-U,--update
Update the index just where it already have an entry matching
<pathspec>. This removes as well as modifies index entries to match
The working tree, but adds no new files.


If no <pathspec> is given when-u option was used, all tracked files
In the entire working tree is updated (old versions's Git used to
Limit the update to the current directory and its subdirectories).

-a-a,--all,--no-ignore-removal
Update the index not only where the working tree has a file
Matching <pathspec> but also where the index already have an entry.
This adds, modifies, and removes index entries to match the working
Tree.


If no <pathspec> is given when-a option was used, all files in the
Entire working tree is updated (old versions of the Git used to limit
The update to the current directory and its subdirectories).


1. Git add-a Save all the changes

2. Git Add. Save new additions and modifications, but do not include delete

3. Git add-u saves modifications and deletions, but does not include new files.

As shown in figure:




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.