Git - Push
About
push will send branch to the remote creating remote branch
Articles Related
Syntax
git push <remote> <branch>
# or
git push origin localBranchName:remoteBranchName
Git automatically expands the branchName out to refs/heads/branchName:refs/heads/branchName, which means:
- Take my branchName local branch and push it to update the remote’s branchName branch.”
Example
Push a local branch to a remote, creating also the remote branch
git push -u origin stable
where:
- origin is the name of a remote
- stable is the name of a branch
- -u set the remote branch as a tracking branch
output:
* [new branch] stable -> stable
Branch 'stable' set up to track remote branch 'stable' from 'origin'.