我从 git 开始。
我想知道该选项的-u作用。
那么 之间有什么区别:
git add对比git add -ugit push对比git push -u
For Add, -u will make it only add updated files - eg. ones that you have already tracked/committed previously.
For Push, -u will make it track the remote branch, so when you do git status it will let you know how many commits ahead/behind the remote branch you are at.
Did you try reading the help?
git help add
git help push
to access it.
As for the specifics:
git add -u does the same as git add . except that it doesn't add untracked files, which the latter does.
git push -u sets the local branch as tracking the remote branch. Generally you only use it when you first push a new branch, and git will even tell you to use it then if you just type git push by mistake (it uses the long name --set-upstream).