DEV Community

Discussion on: Fork and Forkget

Collapse
 
ssinad profile image
Sina D • Edited

Why not have one remote like this?

origin  git@github.com:origin/example.git (fetch)
origin  git@github.com:upstream/example.git (push)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
pmaidens profile image
Peter Maidens

I assume you have your upstream and origin backwards here. The whole point is that we want to push to our origin and fetch from the upstream.

Even if we did switch them around, I still highly suggest having the two be their own remotes. The reason for that is so that you can deal with more than just the main branch on your remote. Pushing code to your origin is a good idea so that you can pull the code down if anything happens to your computer, or if you work on more than one workstation. Another use case is once you put your code onto your fork and make a pull request, someone might actually make a PR to your branch to make suggestions. Once they do, you would need to pull that code back down onto your machine, which would require you tracking origin. In addition, it gets you used to working with multiple remotes for when you start to collaborate with other people and might need to pull branches from their remotes.