Skip to content

DOC better clarify upstream synchronization in contributing guide#13505

Merged
adrinjalali merged 7 commits intoscikit-learn:masterfrom
adrinjalali:doc/git-rebase
Mar 26, 2019
Merged

DOC better clarify upstream synchronization in contributing guide#13505
adrinjalali merged 7 commits intoscikit-learn:masterfrom
adrinjalali:doc/git-rebase

Conversation

@adrinjalali
Copy link
Copy Markdown
Member

@adrinjalali adrinjalali commented Mar 24, 2019

Changes the contributing guides to be explicit about how upstream/master synchronization can be done.

@adrinjalali adrinjalali changed the title clarify upstream synchronization DOC better clarify upstream synchronization in contributing guide Mar 24, 2019
$ git merge upstream/master

with ``master`` being synchronized with the ``upstream``.
In order to synchronize your ``master`` with the ``upstream``'s (assuming you
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this. I don't understand the benefit of teaching rebase either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe git pull upstream master would be enough?

I'd remove the "(assuming you usually work on branches other than your local's master)" part, since we shouldn't give users the idea that it could be done another way.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rebase is just to leave users with a clean master history on their local copy, which I think is good practice and useful later on when users do git log stuff.

The "assuming..." part is kinda to tell users that's how a good practice may look like. Not all users create branches and they may just work on their master. My idea here is to give users an idea of how they can be doing the git-workflow by giving them hints and keywords.

Questions such as #13496 (comment) are not rare among new contributors, and there's a gap between "here's how you add an origin" and "assuming your master is synced with master" in our documentation.

@jnothman I'm not sure which part is not clear here to you. I'm happy to expand and clarify this part, I was trying to keep the additions minimal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Then what about something like this

It is recommended to work on temporary branches rather than directly on master. Since these temporary branches are branched off master, it is helpful to keep your local master up to date with the upstream's master. Do do this, you can...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that, change the wording.

Copy link
Copy Markdown
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not convinced by rebase over pull but I don't mind, LGTM

``master``. To do this, you can::

$ git fetch upstream
$ git rebase upstream/master
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I would usually do git reset --hard upstream/master here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 although it's not necessary to ever use update the local master branch if all the feature branches are branched from upstream/master as recommended in the previous comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I would usually do git reset --hard upstream/master here.

reset --hard is fine as long as the user really knows they're not in their feature branch. I rather not have a command here which could be copy pasted by accident and result in the user loosing their changes.

with ``master`` being synchronized with the ``upstream``.
It is recommended to work on temporary branches rather than directly on
``master``. Since these temporary branches are branched off ``master``, it is
helpful to keep your local ``master`` up to date with the upstream's
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rather than advising this, we should just recommend creating feature branches with:

git fetch upstream
get checkout -b myfeaturename upstream/master

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Copy Markdown
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 once @jnothman's suggestions are taken into account.

``master``. To do this, you can::

$ git fetch upstream
$ git rebase upstream/master
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 although it's not necessary to ever use update the local master branch if all the feature branches are branched from upstream/master as recommended in the previous comment.

@adrinjalali
Copy link
Copy Markdown
Member Author

Is this now a good compromise? No rebase mentioned! (I'm genuinely curious why we don't want to mention it though)

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Mar 25, 2019

LGTM.

$ git merge upstream/master

with ``master`` being synchronized with the ``upstream``.
It is recommended to work on temporary branches rather than directly on
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're talking about how to solve the conflict when merging master from upstream. I can't understand why we mention these things here. (Notice that the next paragraph starts with "Subsequently")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. Should we move it right after where the user clones the fork, and
add the upstream remote etc etc?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that @qinhanmin2014's review is similar to mine :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have

Create a branch to hold your development changes:
$ git checkout -b my-feature

Anyway, this is not a big problem, as long as you can put these things in a suitable place, I won't oppose.

Copy link
Copy Markdown
Contributor

@albertcthomas albertcthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @adrinjalali. We will be able to point the contributors to this section if they ask how to do this.

$ git merge upstream/master

with ``master`` being synchronized with the ``upstream``.
It is recommended to work on temporary branches rather than directly on
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a bit confusing for a first time contributor to read this if he already did point 5. hereabove. We should maybe say : "As explained in 5, it is recommended to work [....]. You can also create your feature branch from the latest upstream/master:"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I would put this paragraph after the paragraph about solving conflicts so that the one about solving conflicts is just after the one explaining how to merge master.

@adrinjalali
Copy link
Copy Markdown
Member Author

This should now address the comments.

Copy link
Copy Markdown
Contributor

@albertcthomas albertcthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

of it you can::

$ git fetch upstream
$ git checkout -b mybranchname upstream/master
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would reuse the same name as above for the branch my-feature.

of it you can::

$ git fetch upstream
$ git checkout -b my-feature upstream/master
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's worth just changing the instructions above rather than adding a note. But I'm fine with this

@adrinjalali
Copy link
Copy Markdown
Member Author

I suppose it's hard to make everybody very happy here, but seems we have enough +1s, so merging.

@adrinjalali adrinjalali merged commit ab399a6 into scikit-learn:master Mar 26, 2019
@adrinjalali adrinjalali deleted the doc/git-rebase branch March 26, 2019 09:43
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…ikit-learn#13505)

* clarify upstream synchronization

* apply Nicolas's comment

* fix typo

* don't mention the rebase

* move the notes

* fix branch name
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…ikit-learn#13505)

* clarify upstream synchronization

* apply Nicolas's comment

* fix typo

* don't mention the rebase

* move the notes

* fix branch name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants