nickpick nickpick - 1 year ago 76
Git Question

After rebasing my github fork, commits from others are in my pull request

I have created a github fork and made some changes, then created a pull request. After some revisions, I made some additional changes and rebased my fork (and then also my local copy), then committed and pushed it again.

Now my pull request contains plenty of changes of other people as well:

What did I do wrong and how can I fix it? I only changed 3 files (pandas/io/, pandas/io/tests/json/ and doc/source/whatsnew/v0.18.1.txt (where I also resolved some conflicts after my rebase).

Any suggestions are appreciated. I'm using pycharm and TortoiseGit.

Answer Source

What did I do wrong?

You made your PR directly from the master branch (which is supposed to reflect the upstream/master branch, and not include other changes)

and how can I fix it

Make sure you have a remote named upstream referencing the original repo (the one you have forked)

git remote -v
# if needed
git remote add upstream /url/original/repo

Then create a branch from upstream/master

git fetch upstream
git checkout -b myPR upstream/master

Finally, cherry-pick the commits representing your changes

git cherry-pick myFirstCommit..myCurrentCommit

And create a PR from that branch (that you can later on update as you did, but with a rebase on top of upstream/master)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download