DEV Community

Discussion on: What does "origin master" mean?

Collapse
 
michaelcurrin profile image
Michael Currin

Indeed, origin is the remote and the name origin is the default or convention.

after you clone, you can see your remote.

$ git remote
origin
Enter fullscreen mode Exit fullscreen mode

And you can see what it points to. You might use GitHub or BitBucket here.

$ git remote -v
origin  git@github.com:MichaelCurrin/daylio-csv-parser.git (fetch)
origin  git@github.com:MichaelCurrin/daylio-csv-parser.git (push)
Enter fullscreen mode Exit fullscreen mode

I guess you could make the fetch and push different but never had to do that.

Collapse
 
michaelcurrin profile image
Michael Currin

And if you are working on a fork, it is useful to have two remotes. One is "origin" for your fork. And one is named "upstream" usually and references to the original repo.

$ git remote add upstream git@github.com:abc/def.git
Enter fullscreen mode Exit fullscreen mode

View

$ git remote
upstream
origin
Enter fullscreen mode Exit fullscreen mode

Verbose

$ git remote -v
# original repo
upstream    git@github.com:abc/def.git (fetch)
upstream    git@github.com:abc/def.git (push)
# my fork
origin  git@github.com:MichaelCurrin/def.git (fetch)
origin  git@github.com:MichaelCurrin/def.git (push)
Enter fullscreen mode Exit fullscreen mode

Your push and pull operations will use origin by default

git checkout master
git pull # i.e. git pull origin master

git checkout my-feat
git pull # i.e. git pull origin my-feat

git push # i.e. git push origin my-feat
Enter fullscreen mode Exit fullscreen mode

And now you can pull the original repo into your fork!

git checkout master
git pull # origin master
git pull upstream master
git push # origin master
Enter fullscreen mode Exit fullscreen mode
Collapse
 
michaelcurrin profile image
Michael Currin