Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

"git add-A" and "git add." in git What are the differences?

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about "git add -A" and "git add ." "What's the difference. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Two ways to branch and merge git

git add -A and git add . git add -u looks functionally similar, but there is still a slight difference

git add . It monitors the workspace state tree and uses it to commit all changes made while working to the staging area, including file content modifications and new files, but not deleted files.

git add -u: It monitors only files that have been added (i.e. tracked files) and commits modified files to staging. add -u does not commit new files (untracked files). (Short for git add -update)

git add -A: is the combination of the above two functions (abbreviation for git add --all)

Here are some examples of how to do it (Git version 1.x):

git initecho Change me > change-meecho Delete me > delete-megit add change-me delete-megit commit -m initial echo OK >> change-merm delete-meecho 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 -ugit status # Changes to be committed:# modified: change-me# deleted: delete-me# Untracked files:# add-me git reset git add -Agit status # Changes to be committed:# new file: add-me# modified: change-me# deleted: delete-me

Summary:

git add -A Commit all changes

git add -u commits modified and deleted files, excluding new files

git add . Submit new and modified files, excluding deleted files

Different versions of git will make a difference:

Git Version 1.x:

Git Version 2.x:

Thank you for reading! About "git add -A" and "git add . "What are the differences?" This article is shared here. I hope the above content can be helpful to everyone so that everyone can learn more knowledge. If you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report