What is the difference between a space and a slash when running git commands?
I sometimes see
git push origin master
(which is a space)
and other times I see
git rebase origin/master
(which uses a slash)
What is the difference in this convention? Is it that the slash notation accesses a local cached copy whereas the space version actually reaches out to the remote repo (github) ?
Master: This is a branch name where we first initiate git and then we use to make commits. And the changes in the master can pull/push into a remote. origin/master: This is a remote branch, which has a local branch named master on a remote named origin.
The term "git origin master" is used in the context of a remote repository. It is used to deal with the remote repository. The term origin comes from where repository original situated and master stands for the main branch. Let's understand both of these terms in detail.
HEAD is not the latest revision, it's the current revision. Usually, it's the latest revision of the current branch, but it doesn't have to be. master is a name commonly given to the main branch, but it could be called anything else (or there could be no main branch). origin is a name commonly given to the main remote.
With git push origin master you tell git to push all of the commits in the currently checked out local branch (i.e. from your file system) to the remote repo identified by the name origin on its remote branch named master .
This is not a "convention". The former is two separate arguments in different positions with different meanings to git push
, and the latter is a single argument which identifies the remote-tracking branch origin/master
.
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