Git add-a and git Add. git add-u roles and differences

Source: Internet
Author: User
Tags commit
Git add-a and git Add. Git add-u looks similar in function, but there's a difference.


git Add. : He will monitor the status tree of the workspace and use it to submit all changes to the staging area, including file content modification (modified) and new files, but excluding deleted files.


Git add-u: He only monitors files that have been added (i.e., tracked file), and he submits the modified files to staging area. Add-u does not submit new files (untracked file). (git add--update abbreviation)


Git add-a: is a collection of the top two features (the abbreviation for git add--all)


Here is a detailed example of how to better understand (Git version 1.x):


Copy Code
Git init
echo Change me > Change-me
echo Delete me > Delete-me
git add change-me delete-me
git commit-m Initial


echo OK >> Change-me
RM delete-me
echo Add me > 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
Copy Code
Summarize:


· Git add-a commit all changes


· Git Add-u commits modified (modified) and deleted (deleted) files, not including new files


·  git Add. Submit New and modified (modified) files, excluding deleted (deleted) files

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.