1

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?

1
  • git help push Commented Apr 17, 2020 at 12:37

1 Answer 1

2
  • 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Middle ground is git push -u origin master, which pushes & tracks only a single branch.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.