What is the difference between "git push" and "git push origin master"?

Ka-Wa Yip

After a git commit, I have two options:

  1. git push
  2. git push origin master

My intent is to push my changes in my local repo to GitHub master branch. In what circumstances do they make a difference?

(Also, what does "origin" here mean?)


[UPDATE]:

I think this is not a duplicate question with this post, because, on the mentioned duplicate post, the question about git push origin and in this question is about git push only.

Makoto

git push assumes that you already have a remote repository defined for that branch. In this case, the default remote origin is used.

git push origin master indicates that you are pushing to a specific remote, in this case, origin.

This would only matter if you created multiple remote repositories in your code base. If you're only committing to one remote repository (in this case, just your GitHub repository), then there isn't any difference between the two.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

'git push origin master' freezes

From Dev

Git push origin master issue

From Dev

git push origin master = permission denied ( publickey )

From Dev

git push origin master not pushing the files

From Dev

git push origin master not pushing the files

From Dev

`git push origin master` does not work

From Dev

Why did git push origin master draw ASCII art?

From Dev

Why "git push origin master" doesn't work?

From Dev

git push origin master: permission denied (public key) error

From Dev

git push origin master: permission denied (public key) error

From Dev

Why "git push origin master" doesn't work?

From Dev

Git failure in uploading using "git push origin master"

From Dev

Why was "git push origin master" used when origin wasn't a remote name?

From Dev

Can I use git push origin master:myBranch to push code I modified in master branch to my branch?

From Dev

git push origin master shows eveything up-to-date but nothing is pushed

From Dev

What is the difference between 'git push foo bar -f' and 'git push foo +bar'?

From Dev

What is the difference between git push origin HEAD and git push origin [current-branch-name]?

From Dev

Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?

From Dev

Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?

From Dev

What's the difference between the tags of git push and git commit

From Java

What are the differences between "git commit" and "git push"?

From Dev

Difference between 'git push -f' and 'deleting remote branch and push again'

From Dev

Difference between 'git push -f' and 'deleting remote branch and push again'

From Dev

Difference between origin master & origin/master with git pull and git push commands

From Dev

What is the reason of error on git push?

From Dev

What's the difference between "as?", "as!", and "as"?

From Dev

What is the difference in operation between . and ^ and ^(.*)$?

From Dev

What is the difference between .// and //* in XPath?

From Dev

What is the difference between = and => for a variable?

Related Related

  1. 1

    'git push origin master' freezes

  2. 2

    Git push origin master issue

  3. 3

    git push origin master = permission denied ( publickey )

  4. 4

    git push origin master not pushing the files

  5. 5

    git push origin master not pushing the files

  6. 6

    `git push origin master` does not work

  7. 7

    Why did git push origin master draw ASCII art?

  8. 8

    Why "git push origin master" doesn't work?

  9. 9

    git push origin master: permission denied (public key) error

  10. 10

    git push origin master: permission denied (public key) error

  11. 11

    Why "git push origin master" doesn't work?

  12. 12

    Git failure in uploading using "git push origin master"

  13. 13

    Why was "git push origin master" used when origin wasn't a remote name?

  14. 14

    Can I use git push origin master:myBranch to push code I modified in master branch to my branch?

  15. 15

    git push origin master shows eveything up-to-date but nothing is pushed

  16. 16

    What is the difference between 'git push foo bar -f' and 'git push foo +bar'?

  17. 17

    What is the difference between git push origin HEAD and git push origin [current-branch-name]?

  18. 18

    Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?

  19. 19

    Git Push: What is the difference between HEAD:refs/heads/<branch> and <branch>?

  20. 20

    What's the difference between the tags of git push and git commit

  21. 21

    What are the differences between "git commit" and "git push"?

  22. 22

    Difference between 'git push -f' and 'deleting remote branch and push again'

  23. 23

    Difference between 'git push -f' and 'deleting remote branch and push again'

  24. 24

    Difference between origin master & origin/master with git pull and git push commands

  25. 25

    What is the reason of error on git push?

  26. 26

    What's the difference between "as?", "as!", and "as"?

  27. 27

    What is the difference in operation between . and ^ and ^(.*)$?

  28. 28

    What is the difference between .// and //* in XPath?

  29. 29

    What is the difference between = and => for a variable?

HotTag

Archive