me9867
me9867

Reputation: 1599

Git push command for Bitbucket

For my first commit to an empty repo on Bitbucket. Which of the following commands do I use?

git push -u origin master
git push origin master
git push -u origin 

What is the difference between these?

Upvotes: 2

Views: 2910

Answers (4)

derOtterDieb
derOtterDieb

Reputation: 555

Well, -u is for "upstream" if I remember well, setting the current branch as the "default" branch for your project.

Master is the name of the branch, so just use "master" as default if you have only one branch, else use the name of the branch you want to use.

Origin : "origin is just an alias for an end-point, which can realistically be anything." – @Stephan Bijzitter who added a comment to my post to correct it, I think it's better to edit with the right answer.

Upvotes: -1

ASD Burrito
ASD Burrito

Reputation: 172

For example if you are working on your local repository on the directory /example, and you change a file a.txt.

Do the following steps for push a.txt:

git add /example/a.txt
git commit -m 'Comment for commit'
git push -u origin master

You can see the state of your repository using:

git status

Upvotes: 2

tester125
tester125

Reputation: 21

First is right

git push -u origin master

but it doesn't matter, initial commit = another commit

:)

Upvotes: 1

Matanm
Matanm

Reputation: 11

I simply use:

git push

But make sure you cloned the repo first.

Upvotes: 0

Related Questions