git: Pulling from master

Dirk Hohndel dirk at hohndel.org
Fri Nov 17 07:38:49 PST 2017


> On Nov 17, 2017, at 2:20 AM, Jan Mulder <jlmulder at xs4all.nl> wrote:
> 
> On 17-11-17 10:59, Willem Ferguson wrote:
>> I am  sorting out the Github mechanism for myself.
>> Two questions:
>> 1) The upstream repository. Currently there are two such repositories:
>> i) git://subsurface.hohndel.org/subsurface.git  [git has the label "origin"]
>> ii) https://github.com/Subsurface-divelog/subsurface [git has the label "upstream"]
>> What is the current relationship between these two repositories?
> 
> Dirk can tell that (when he wakes up), but just don't bother with the git://subsurface.hohndel.org/subsurface.git one. You do not need it.

This is a sign how long you have been involved in Subsurface :-)
For a while (quite a while) we ran everything on our own (read: mine) infrastructure.
And initially that was based on my domain, hohndel.org (since 2011).
Then, in 2014 I registered subsurface-divelog.org and migrated things to there, including the git server and preferred address (of course with a DNS forward). 
Thankfully last year smarter people convinced me to instead move to GitHub and use its PR and issue instead of doing all this on my own server.
So the git://git.subsurface-divelog.org server is still around (in order not to break old scripts, links, and the working setups of contributors), and subsurface.hohndel.org might still point there (but hasn't been tested / verified by me in ages) but I consider git://github.com/Subsurface-divelog/subsurface the true reference.

>> $ git remote -v
> 
> my git remote -v
> 
> origin  git at github.com:janmulder/subsurface.git (fetch)
> origin  git at github.com:janmulder/subsurface.git (push)

That's a good way to do it for people who have a fork on GitHub

> upstream        git at github.com:Subsurface-divelog/subsurface.git (fetch)
> upstream        git at github.com:Subsurface-divelog/subsurface.git (push)

That of course only works for the maintainers - Jan is one of the people who can, indeed, push to the official repo.

>> I get:
>> fork    https://github.com/willemferguson/subsurface (fetch) [this comes from doing git remote add fork https://github.com/willemferguson/subsurface ]
>> fork    https://github.com/willemferguson/subsurface (push)
>> origin    git://subsurface.hohndel.org/subsurface.git (fetch)
>> origin    git://subsurface.hohndel.org/subsurface.git (push)
>> upstream    https://github.com/Subsurface-divelog/subsurface (fetch)
>> upstream    https://github.com/Subsurface-divelog/subsurface (push)
> 
> And I use a stupid script to get things synced:
> 
> git checkout master
> git tag -d continuous # recently added to get the continuous label moved
> git fetch upstream
> git merge upstream/master
> git push origin master # push things to my github account

And just in case that isn't obvious - there really isn't a huge need to keep the 'master' in your fork in sync with upstream. You can always just pull from upstream on your local machine.
And there's even a small risk here. If you think that your master is in sync but it actually has a stray commit in there, then the SHAs don't match and PRs start getting weird.

/D


More information about the subsurface mailing list