Git push vs git push origin

0 votes
What's the difference between git push and git push origin?
Dec 13, 2018 in Git & GitHub by Hannah
• 14,080 points
3,332 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

hey @Hannah, 

Basically git push implicitly pushes to your work to a remote repository, with the assumption that it already exists. By default this remote repository is the origin.

In case of git push origin, it explicitly specifies to be pushed into a repository called origin.

Git push origin is usually used only where there are multiple remote repository and you want to specify which remote repository should be used for the push.

answered Dec 16, 2018 by anonymous
0 votes

Git push is mostly used to publish uploaded local changes to a central repository. After a local repo has been modified a push is executed to share the modifications. 

example:

git checkout master
git fetch origin master
git rebase -i origin/master
# Squash commits, fix up commit messages etc.
git push origin master
answered Apr 23 by Barbara
0 votes

In simple words git push command updates the remote repository with local commits. The origin represents a remote name where the user wants to push the changes.

git push command push commits made on a local branch to a remote repository.

The git push command basically takes two arguments:

  • A remote name, for example, origin
  • A branch name, for example, master

Syntax:

git push <REMOTENAME> <BRANCHNAME>
answered Apr 23 by Hiran

Related Questions In Git & GitHub

0 votes
1 answer

Git origin not found

For this to work, you need to ...READ MORE

answered Apr 25, 2018 in Git & GitHub by DragonLord999
• 8,360 points
51 views
0 votes
1 answer

Git pull vs Git Fetch

The objective of both these commands is ...READ MORE

answered Apr 26, 2018 in Git & GitHub by DragonLord999
• 8,360 points
131 views
0 votes
1 answer

gerrit-cherry-pick:fatal: 'origin' does not appear to be a git repository

The user account making that command does ...READ MORE

answered Aug 13, 2018 in Git & GitHub by Kalgi
• 35,800 points
113 views
+1 vote
1 answer

Git: Remove committed file after push

check out the previous (unchanged) state of ...READ MORE

answered Aug 14, 2018 in Git & GitHub by Kalgi
• 35,800 points
86 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

What is git rebasing?

Git rebasing is moving or combining different ...READ MORE

answered Dec 16, 2018 in Git & GitHub by Kiyara
54 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.