Confused about github rebasing

Alex Rønne Petersen xtzgzorex at gmail.com
Thu Mar 15 12:59:57 PDT 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


More information about the Digitalmars-d-learn mailing list