Two methods of branching and merging in git
git add -A and git add . git add -u seems to be very similar in function, but it still exists A little difference
git add . : It will monitor the status tree of the workspace, and use it to submit all changes during work to the temporary storage area, including file content modifications (modified) and New files (new), but not deleted files.
git add -u : It only monitors the files that have been added (tracked files), and it will submit the modified files to the temporary storage area. add -u will not commit new files (untracked files). (Abbreviation of git add --update)
git add -A : It is a collection of the above two functions (abbreviation of git add --all)
The following is Specific operation examples for better understanding (Git version 1.x):
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
Summary:
git add -A Submit all changes
git add -u Submit modified and deleted files, excluding new files (new)
git add . Submit new files (new) and modified (modified) files, excluding deleted (deleted) files
There will be differences depending on the git version:
Git Version 1.x :
Git Version 2.x:
Recommended tutorial: "Java Tutorial"
The above is the detailed content of The difference between 'git add -A” and 'git add .”. For more information, please follow other related articles on the PHP Chinese website!