Git Add Command explanation

Source: Internet
Author: User
Git add is actually (git add file into staged area)
Purpose: Can be used to track new files, or to add tracked files that have been modified to the buffer, or to mark a merged conflict file as resolved,

Git add is intended to update the current working directory tree modified content into the index (that is, the cache) mainly for the two Files:(1) The repository does not track the files (2) The repository has been tracked, but the modified files in addition git add automatically ignores the files that are ignored by the. gitignore file. There are also two more commonly used options--force-f forcing is primarily to track changes to files and directories that have been filtered by the Gitignore file.
Next to the configuration in the. gitignore file, omit the file ending in. txt, but do not ignore the files under the testdir/folder. As shown below, the following dir1.txt is not detected, mainly because Dir1.txt is not in the TestDir directory, and ends in. txt, is ignored

With git add--all add can see only trace to two files, if we want Git repository trace dir1.txt file, you can add the-f option git add--all-f
The above git add-f and git add--all are most commonly used, and now we want to delete the contents of the staged area, which will be mentioned in the next section.

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.