Skip to content

DOC: update contributing guide regarding updating a pull request (merge master) #19990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche added this to the 0.23.0 milestone Mar 5, 2018
@codecov
Copy link

codecov bot commented Mar 5, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@87f5654). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #19990   +/-   ##
=========================================
  Coverage          ?   91.71%           
=========================================
  Files             ?      150           
  Lines             ?    49112           
  Branches          ?        0           
=========================================
  Hits              ?    45045           
  Misses            ?     4067           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.1% <ø> (?)
#single 41.86% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87f5654...c5b0475. Read the comment docs.

@datapythonista
Copy link
Member

Looks great. Is it any reason to not use the --set-upstream (or -u) in the first push to the branch, so in the other pushes they need to repeat the remote and branch again? I'd say it's more common this way, not sure if there is a reason I'm missing to not use it.

@jreback
Copy link
Contributor

jreback commented Mar 5, 2018

@datapythonista actually should check out tracking branches in the first place, e.g.

git checkout -b shiny-new-feature --track origin/master

is usually the correct thing to do

@jorisvandenbossche
Copy link
Member Author

I'd say it's more common this way, not sure if there is a reason I'm missing to not use it.

Yes, the only problem is then that those commands won't work if you didn't do that in the first place. So I am certainly in favor of mentioning this when creating the branch (as @jreback points out) or when doing the first push. But maybe we can still keep the general working method here? (although it being more verbose)

(I personally have just my general setting of git to push to same-named branches, so I never do -u or --track origin/master)

@jorisvandenbossche
Copy link
Member Author

@jschendel did you delete your comment? I think it was relevant:

Earlier in this doc, under the "Creating a Branch" section, the prescribed procedure for updating a branch is slightly different:

git fetch upstream
git rebase upstream/master

Is there a reason to prefer rebase in the former section, and merge in this one? Since these sections are relatively far apart it might be nice to provide a quick link between the two sections, and briefly mention when to use one method vs, another? Or could maybe just use a consistent command in each section?

You could say that as long as this is before submitting the PR this is fine, but then it can be confusing that we give different guidelines on how to update a branch before and after you submitted a PR ?
We could also just remove that section, since this is now covered by my new section.

@jschendel
Copy link
Member

Yeah, I deleted my comment since I missed part of the mailing list discussion thread, and finding it cleared up some of my confusion. I'm +1 on removing the rebase portion of the "Creating a Branch" section. Seems like that's the most straightforward option that would result in the least amount of confusion for new contributors, especially if we want to nudge them towards using merge instead of rebase.

@jorisvandenbossche
Copy link
Member Author

@jschendel @jreback @TomAugspurger or any body else -> Question: how do you typically update your master branch with upstream/master? (before creating a new feature branch)

Because that is currently not really mentioned in the contributing guide (it only mentions how to update a branch with rebase, which I will change to merge).

I have an git alias that does:

git fetch upstream
git merge upstream/master --ff-only

I have the --ff-only added because in principle I never committed myself on master and only in branches, and this ensures that this is the case (which is a check that git pull upstream master will not do I think, but of course could do git pull upstream master --ff-only as well)

What do others do for this step? Or what would be the best to recommend in the contributing guide?

@jreback
Copy link
Contributor

jreback commented Mar 8, 2018

i have a local tracking branch: master that tracks upstream/master

so
gilt pull

does it all for me

@jorisvandenbossche
Copy link
Member Author

Yes in that case git pull upstream master will do the same as git pull I think?
So for the contributing guide, let's assume no set-up tracking branch, and give the full command that certainly works ?

(and git pull upstream master --ff-only will still further do exactly the same as git pull if you have no commits on local master that are not present in upstream master. But again, I would like to give the command that is fully save. Somebody who knows git will know how to simplify it).

@jschendel
Copy link
Member

Question: how do you typically update your master branch with upstream/master? (before creating a new feature branch)

I only had basic git skills when I started contributing to pandas, so I just followed the contributing guide, probably too closely, and was using the previously recommended rebase procedure of:

git fetch upstream
git rebase upstream/master

Definitely overkill though, as I never actually make changes on master.

@jorisvandenbossche
Copy link
Member Author

jorisvandenbossche commented Mar 9, 2018

Definitely overkill though, as I never actually make changes on master.

Yes, and therefore also the wrong recommendation I think, as if you made changes by accident to master, it will not do what you want (it should complain instead IMO).
Although that a plain git merge upstream/master certainly does the wrong thing as well if you have commits on master .. That's the reason I would recommend --ff-only

@jschendel
Copy link
Member

jschendel commented Mar 9, 2018

therefore also the wrong recommendation I think

Yes, didn't mean for that to sound like I was suggesting the rebase approach that was previously in the docs; was also trying to say that my approach is not the right one here. The fast-forward approach seems like the most appropriate one to me.

@jorisvandenbossche
Copy link
Member Author

Yes, I didn't interpret it like that! You nicely followed are guidelines :-)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. very minor comments.

default commit message will open, and you can simply save and quit this file.

If there are merge conflicts, you need to solve those conflicts. See for
example at https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/
Copy link
Contributor

Choose a reason for hiding this comment

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

need to make this an http ref

Copy link
Member Author

Choose a reason for hiding this comment

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

sphinx does that automatically

added, you can run ``git commit`` to save those fixes.

If you have uncommitted changes at the moment you want to update the branch with
master, you will need to ``stash`` them prior to updating. This will effectively
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a reference to git stash here (git docs)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

store your changes and they can be reapplied after updating.

After the feature branch has been update locally, you can now update your pull
request by pushing to the branch on GitHub::
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a comment about -f force option of push (they shouldn't use it)

@jorisvandenbossche
Copy link
Member Author

Any more comment?

@jorisvandenbossche jorisvandenbossche merged commit 0368927 into pandas-dev:master Mar 16, 2018
@jorisvandenbossche jorisvandenbossche deleted the doc-contributing-update branch March 16, 2018 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants