Reputation: 1251
I'm following this tutorial on pushing an existing project to Bitbucket, and it mentions using the command git push -u origin --all
. How does this command differ from git push origin master
?
Upvotes: 1
Views: 757
Reputation: 1970
git push origin master
pushes your current branch up to the
master
branch on origin
.git push -u origin -all
pushes all
branches to origin. The -u
option sets up your local branches to
track the remote branches. This essentially establishes a link between your local branch, and the branch on the remote repository. Without doing this if you switch to one of these branches and do a git push
you'll be greeted with an error message fatal: The current branch <branch-name> has no upstream branch.
You can check the branch link by command git branch -vv
.Summary: git push -u origin -all
pushes all branches to origin, git push origin master
pushes your current branch up to the master
branch on origin.
Upvotes: 2