Simply, we can say that git push command updates the remote repository with local commits. And origin represents a remote name where the user wants to push the changes.
origin stands for your remote repository. So when you use "git push origin [branch-name]", you are saying push my code to a branch called [branch-name] in this specific remote repository called "origin". Most of the time you only have one remote repository and "origin" is the default name git gives to it.
Origin is simply the name given to any remote repository available on GitHub. Whenever we need to push the changes to a remote repository, we use git push along with the remote repository “origin” and “master” branches. The term used is “git push origin master“.
The first push should be a:
git push -u origin branchname
That would make sure:
origin
',simple
'
Any future git push will, with that default policy, only push the current branch, and only if that branch has an upstream branch with the same name.
that avoid pushing all matching branches (previous default policy), where tons of test branches were pushed even though they aren't ready to be visible on the upstream repo.
First, you need to create your branch locally
git checkout -b your_branch
After that, you can work locally in your branch, when you are ready to share the branch, push it. The next command push the branch to the remote repository origin and tracks it
git push -u origin your_branch
Your Teammates/colleagues can push to your branch by doing commits and then push explicitly
... work ...
git commit
... work ...
git commit
git push origin HEAD:refs/heads/your_branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With