Thread overview
How to contribute on github?
May 11, 2012
Mehrdad
May 11, 2012
Mehrdad
May 11, 2012
Jonathan M Davis
May 11, 2012
Trass3r
May 11, 2012
I haven't used git or github much. (Pretty much just once or twice, when someone added me.)

How do I go about submitting potential changes to Phobos?

(All I see on there is "GIT Read-only" which I feel is read-only, not something I can/know how to modify...)
May 11, 2012
On 12-05-2012 00:22, Mehrdad wrote:
> I haven't used git or github much. (Pretty much just once or twice, when
> someone added me.)
>
> How do I go about submitting potential changes to Phobos?
>
> (All I see on there is "GIT Read-only" which I feel is read-only, not
> something I can/know how to modify...)

OK, so what you do is you fork the Phobos repo. You then set up your local clone like so:

$ mkdir phobos
$ cd phobos
$ git init .
$ git remote add upstream git@github.com:D-Programming-Language/phobos.git
$ git remote add origin git@github.com:YourUserNameHere/phobos.git
$ git fetch origin && git fetch upstream
$ git checkout -b master origin/master

Now you have a working directory and a local master branch set up to track your fork's remote master branch.

Now you simply add commits to your repo, push them to GitHub (git push origin master), and send a pull request to the upstream Phobos repository.

Synchronizing with upstream can basically be done like so:

$ git fetch upstream
$ git pull --rebase upstream master
$ git push origin master -f

This fetches the latest changes from upstream, unrolls your fork's commits, adds in upstream's commits, then readds your fork's commits, and finally, force-pushes your local branch to your remote branch (the force push is necessary because you rewrite history, which is OK in your personal fork).

-- 
- Alex
May 11, 2012
http://help.github.com/fork-a-repo/
May 11, 2012
> OK, so what you do is you fork the Phobos repo. You then set up your local clone like so:
>
> $ mkdir phobos
> $ cd phobos
> $ git init .
> $ git remote add upstream git@github.com:D-Programming-Language/phobos.git
> $ git remote add origin git@github.com:YourUserNameHere/phobos.git
> $ git fetch origin && git fetch upstream
> $ git checkout -b master origin/master
>
> Now you have a working directory and a local master branch set up to track your fork's remote master branch.
>
> Now you simply add commits to your repo, push them to GitHub (git push origin master), and send a pull request to the upstream Phobos repository.
>
> Synchronizing with upstream can basically be done like so:
>
> $ git fetch upstream
> $ git pull --rebase upstream master
> $ git push origin master -f
>
> This fetches the latest changes from upstream, unrolls your fork's commits, adds in upstream's commits, then readds your fork's commits, and finally, force-pushes your local branch to your remote branch (the force push is necessary because you rewrite history, which is OK in your personal fork).



Oooh... so I actually need to fork! I didn't know that. (I thought it was for when you want to make a different project based on something, not just commit to an existing project.)

Awesome, I'll try that; thanks!
May 11, 2012
On Saturday, May 12, 2012 00:34:45 Alex Rønne Petersen wrote:
> On 12-05-2012 00:22, Mehrdad wrote:
> > I haven't used git or github much. (Pretty much just once or twice, when
> > someone added me.)
> > 
> > How do I go about submitting potential changes to Phobos?
> > 
> > (All I see on there is "GIT Read-only" which I feel is read-only, not something I can/know how to modify...)
> 
> OK, so what you do is you fork the Phobos repo. You then set up your local clone like so:
> 
> $ mkdir phobos
> $ cd phobos
> $ git init .
> $ git remote add upstream git@github.com:D-Programming-Language/phobos.git
> $ git remote add origin git@github.com:YourUserNameHere/phobos.git
> $ git fetch origin && git fetch upstream
> $ git checkout -b master origin/master
> 
> Now you have a working directory and a local master branch set up to track your fork's remote master branch.
> 
> Now you simply add commits to your repo, push them to GitHub (git push origin master), and send a pull request to the upstream Phobos repository.
> 
> Synchronizing with upstream can basically be done like so:
> 
> $ git fetch upstream
> $ git pull --rebase upstream master
> $ git push origin master -f
> 
> This fetches the latest changes from upstream, unrolls your fork's commits, adds in upstream's commits, then readds your fork's commits, and finally, force-pushes your local branch to your remote branch (the force push is necessary because you rewrite history, which is OK in your personal fork).

It works better if you just never do any work on the master branch and have the master branch match the main repository's master branch. Then you can always have up-to-date code which matches the actual code in the main repository, and it avoids any rebasing issues that you might have on your master branch (especially when your changes conflict with changes in the main repository). It also makes it easier to manage separate changes by having a branch for each. There's certainly nothing stopping you from doing work on your master branch, but it's generally more problematic to do so.

- Jonathan M Davis
May 14, 2012
On Fri, 11 May 2012 18:34:45 -0400, Alex Rønne Petersen <xtzgzorex@gmail.com> wrote:

> On 12-05-2012 00:22, Mehrdad wrote:
>> I haven't used git or github much. (Pretty much just once or twice, when
>> someone added me.)
>>
>> How do I go about submitting potential changes to Phobos?
>>
>> (All I see on there is "GIT Read-only" which I feel is read-only, not
>> something I can/know how to modify...)
>
> OK, so what you do is you fork the Phobos repo. You then set up your local clone like so:
>
> $ mkdir phobos
> $ cd phobos
> $ git init .
> $ git remote add upstream git@github.com:D-Programming-Language/phobos.git
> $ git remote add origin git@github.com:YourUserNameHere/phobos.git
> $ git fetch origin && git fetch upstream
> $ git checkout -b master origin/master

Wow, this is way more complicated than it needs to be.

$ git clone git@github.com:YourUserNameHere/phobos.git
$ cd phobos
$ git remote add upstream https://github.com/D-Programming-Language/phobos.git
$ git fetch upstream

This should be enough to set up the dev environment in the same way you specified above.  I recommend you use a new branch for any changes, like Jonathan said.

Note that you must use https if you have read-only access, ssh isn't available.

-Steve
May 14, 2012
On 14-05-2012 13:45, Steven Schveighoffer wrote:
> On Fri, 11 May 2012 18:34:45 -0400, Alex Rønne Petersen
> <xtzgzorex@gmail.com> wrote:
>
>> On 12-05-2012 00:22, Mehrdad wrote:
>>> I haven't used git or github much. (Pretty much just once or twice, when
>>> someone added me.)
>>>
>>> How do I go about submitting potential changes to Phobos?
>>>
>>> (All I see on there is "GIT Read-only" which I feel is read-only, not
>>> something I can/know how to modify...)
>>
>> OK, so what you do is you fork the Phobos repo. You then set up your
>> local clone like so:
>>
>> $ mkdir phobos
>> $ cd phobos
>> $ git init .
>> $ git remote add upstream
>> git@github.com:D-Programming-Language/phobos.git
>> $ git remote add origin git@github.com:YourUserNameHere/phobos.git
>> $ git fetch origin && git fetch upstream
>> $ git checkout -b master origin/master
>
> Wow, this is way more complicated than it needs to be.
>
> $ git clone git@github.com:YourUserNameHere/phobos.git
> $ cd phobos
> $ git remote add upstream
> https://github.com/D-Programming-Language/phobos.git
> $ git fetch upstream
>
> This should be enough to set up the dev environment in the same way you
> specified above. I recommend you use a new branch for any changes, like
> Jonathan said.
>
> Note that you must use https if you have read-only access, ssh isn't
> available.
>
> -Steve

Yes, I know it can be done much shorter, but to a beginner, the stuff I listed usually seems less 'magical'.

-- 
- Alex
May 14, 2012
On Mon, 14 May 2012 08:09:48 -0400, Alex Rønne Petersen <xtzgzorex@gmail.com> wrote:

> Yes, I know it can be done much shorter, but to a beginner, the stuff I listed usually seems less 'magical'.

It's not magical if you don't wonder about it.

For example, setting up origin was a detail I never even thought about until I had to create my own repository ;)  I thought it was just implicitly defined.

Most people aren't interested in knowing the inner workings of git, they only care about getting their contributions into the right place.

-Steve