I have a pull request here, and when I did "git rebase", it added commits that I didn't author into the pull request. The remote branch I'm merging is ahead of all of those commits so I don't understand why they are getting into PR. Any idea how to undo this, or how to prevent this in the future?
Here's what I did
# Checkout local branch and apply changes
mkdir /home/yaroslavvb/tfimmediate_fresh
cd /home/yaroslavvb/tfimmediate_fresh
git clone https://github.com/yaroslavvb/tensorflow.git
cd tensorflow
git checkout tfimmediate_fresh
# do my modifications
git commit -m "Changes"
# Rebase against main branch
git remote add tfmain https://github.com/tensorflow/tensorflow.git
git fetch tfmain
git rebase tfmain/master
# fix conflicts
git add tensorflow/contrib/__init__.py
git rebase --continue
git pull
# fix conflicts again
git add tensorflow/contrib/__init__.py
git commit -m "Fix merge conflicts"
git push
git push -f
After this, my pull request contains changes in master branch that I didn't author
While rebasing, you did a git pull
after your git rebase --continue
.
This will merge new commits from the origin/master branch with your local branch, and so includes the merged commits in your pull request.
After rebasing you should just push the changes to the branch you will use for the Pull Request.