2

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?

dimid
  • 7,285
  • 1
  • 46
  • 85
me9867
  • 1,519
  • 4
  • 25
  • 53
  • 2
    Possible duplicate of [How to push local changes to a remote git repository on bitbucket](http://stackoverflow.com/questions/7690108/how-to-push-local-changes-to-a-remote-git-repository-on-bitbucket) – FoldFence May 20 '16 at 10:06

4 Answers4

2

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
ASD Burrito
  • 172
  • 1
  • 10
1

First is right

git push -u origin master

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

:)

tester125
  • 21
  • 7
0

I simply use:

git push

But make sure you cloned the repo first.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Matanm
  • 11
  • 1
-1

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.

derOtterDieb
  • 545
  • 4
  • 12
  • 35