AFAIK, git does the following when entering the following command:
"git push -u origin master":
- Git checks if master branch is located in remote repo. If not it will create it.
- Git determines the diff between the local branch and the remote branch. Git updates the "diff" in the remote branch.
- Git will also create a new REMOTE TRACKING branch in the local machine named "origin/master" to track the remote branch.
- Git will set the non-tracking branch named "master" to be a tracking branch (in order to track "origin/master").
This will cause 3 branches to exist:
- Tracking branch named "master" in my local machine (tracks origin/master).
- Remote tracking branch named "origin/master" in my local machine.
- Remote branch named "master" in remote repository"
Is this correct?
Re-edit: assume the master branch exist in local machine.
Thanks in advance.