1

I've forked a repo. I've made some commits to my repo and made a 1st pull request. They where already merged into original repo. Now I added more commits and I want to make a 2nd pull request.

There are two problems:

  1. Original repo was modified and I don't have this changes in my repo. I tried to make a fetch from the URL of the original repo (with Tortoise Git), but that didn't seem to work (there was nothing to commit after that).
  2. I'm unable to create a pull request with anything other then was already pulled.

Would like to use Tortoise Git for that, but I can use git command line if I must ;-).

commits and branches

Legend:

  • green boxes are revisions that were already pushed to original repo.
  • red boxes are revisions that I want to push to original repo.
  • number 4 is the one I should merge into my repo.

PS: I've read about branching and merging on git-scm, but that seem to be about merging and branching in a single repo.

EDIT: This seem to answer my first problem: Pull new updates from original GitHub repository into forked GitHub repository I'm not sure if I were supposed to do merge or rebase in this case, though...

Community
  • 1
  • 1
Nux
  • 9,276
  • 5
  • 59
  • 72
  • I'd go with a rebase if possible; that will make your pull request a bit cleaner. (It won't have any stray merge commits in it.) – Ajedi32 Jul 30 '13 at 19:26
  • But would that mean 5,6,7,8 would be a single revision? I'm not sure I want that. – Nux Jul 30 '13 at 21:29
  • 1
    No that's not what a rebase does. http://git-scm.com/book/en/Git-Branching-Rebasing – Ajedi32 Jul 31 '13 at 02:56
  • Thanks, but bottom section makes me want to stick to merging ;-). It seems more clear to me. I'll probably rebase next time before I make my own commits. – Nux Jul 31 '13 at 11:30

1 Answers1

2

You need to do the following:

git fetch original
git rebase original/master
git push origin master

(with 'original' being the name of the remote referring to the original repo url.
'upstream' would be a better name, since it wouldn't be so close to 'origin')
(if you already pushed your master branch, you would need to do a git push --force origin master)

See "Pull new updates from original Github repository into forked Github repository";

upstream vs. fork

Your pull request will be automatically updated (no need to "redo" a pull request).

But please: always make your pull request in a branch, not in master: see "How to do a Github pull request?".
master should reflect exactly what is in upstream ('original') master.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • So basically if work on anything new I should create a branch for it? Seems kind of strange, wouldn't that be an overkill? – Nux Jul 31 '13 at 11:20
  • 1
    @Nux if you want on anything new that is candidate for a pull request. In that case, it isn't overkill. If it is specific to your fork only (no pull request), then you can use one branch if you want. – VonC Jul 31 '13 at 11:22