git -u flag
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
Explanation of git -u flag:
- -u
flag in git is short for --update
. It specifies that the remote-tracking branches will be updated if a new branch is pushed. It links the local branch to the remote one, setting it as the default upstream branch.
When using this flag with git push
:
git push -u origin master
Explanation:
- git push -u origin master
pushes the local changes from the master
branch to the origin
remote and sets up the tracking relationship. After this, future git pull
and git push
commands on the master
branch can be used without specifying the remote and branch name.