March 15, 2012
I'm trying to submit a pull request for druntime, but I'm running into a git problem. This is what I did:

- (I forgot that my master branch is out of date)
- created a new branch for the fix and committed some changes
- switched to master and ran 'git pull'
- now master is ahead of the branch by a number of commits
- switched back to branch
- ran 'git rebase master' to pull in changes from master and apply my
  changes on top of it
- checked that history looks clean
- 'git push -u origin newbranch'
- submit pull request: but now github thinks my branch has a whole bunch
  of commits I didn't make (looks like the commits made by rebase).

So my question is, what did I do wrong, and what's the right way to pull in the latest changes from upstream without messing up the history?


T

-- 
English is useful because it is a mess. Since English is a mess, it maps well onto the problem space, which is also a mess, which we call reality. Similarly, Perl was designed to be a mess, though in the nicests of all possible ways. -- Larry Wall
March 15, 2012
On 15-03-2012 20:13, H. S. Teoh wrote:
> I'm trying to submit a pull request for druntime, but I'm running into a
> git problem. This is what I did:
>
> - (I forgot that my master branch is out of date)
> - created a new branch for the fix and committed some changes
> - switched to master and ran 'git pull'
> - now master is ahead of the branch by a number of commits
> - switched back to branch
> - ran 'git rebase master' to pull in changes from master and apply my
>    changes on top of it
> - checked that history looks clean
> - 'git push -u origin newbranch'
> - submit pull request: but now github thinks my branch has a whole bunch
>    of commits I didn't make (looks like the commits made by rebase).
>
> So my question is, what did I do wrong, and what's the right way to
> pull in the latest changes from upstream without messing up the history?
>
>
> T
>

Let's say you're on your branch with your commits. You have a remote called dpl, which is upstream. So:

$ git fetch dpl
$ git pull --rebase dpl master
$ git push origin <your branch> -f

Note the -f, since you're overwriting remote history in your repo.

-- 
- Alex