Reputation: 5380
I'm contributing to a project on GitHub.
I did the following:
After many days, I got some comments and I have to make some more changes.
But their code has changed a lot since then. If I have to make a pull request again, I must update my new branch with their updated code and merge my changes.
How do I do this?
EDIT:
Before any of this my git log
looked like this:
commit A "feature done" (latest, what I wanted to push)
commit B "feature still acting weird"
I exactly did as VonC suggested (except that I was in my feature branch when I fetch
ed).
My rebase
had conflicts.
When I tried resolving them I was surprised to find that it was rebasing commit B
and not A
over the upstream master. I've checked this many times: git log
shows exactly what I showed.
Why is it rebasing a previous commit of mine over the upstream master?
EDIT:
I fixed the above issue by squashing my 2 commits A
and B
into one.
Don't know why it happened though...
Upvotes: 1
Views: 127
Reputation: 1324937
You need to:
add the original repo as a new remote:
git remote add upstream https://github.com/user/repo
fetch from "upstream"
git fetch upstream
rebase your brach on top of upstream/master
git checkout yourBranch
git rebase upstream/master
force a push to your fork: that will update your pull request automatically:
git push --force origin yourBranch
Upvotes: 2