DEV Community

Discussion on: What does "origin master" mean?

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