|
Boost : |
Subject: Re: [boost] [Git] Pull requests and rebasing
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-04-22 19:29:45
On 23/04/2015 06:11, John Maddock wrote:
> On 16/04/2015 23:52, Gavin Lambert wrote:
>> "git pull --rebase" is for updating "feature" branches -- ie. it's
>> what the submitter of the PR would do on the PR branch itself to
>> incorporate changes made on the parent branch (eg. "develop") into the
>> PR branch, to make it easier to merge.
>>
>> You should never ever run that command on your mainline branches
>> (master and develop).
>>
>
> Indeed, and I've found a way to do what I want:
>
> 1) Create a temporary local branch off develop and switch to it.
> 2) Merge the PR using git pull --rebase: now the PR commit is somewhere
> in the commit history prior to your last commits.
> 3) Revert the tree to the last commit from the PR.
> 4) Merge from develop using rebase - now the commits will be swapped
> round so the PR ends up at the end of the commit log.
> 5) Test.
> 6) Merge temp branch into develop: you should now have a clean history
> in develop with the PR commits at the end.
> 7) Delete the temp branch.
Admittedly I mostly use TortoiseGit, so I'm a little unfamiliar with the
command-line, but that seems more complex than it needs to.
1. Create a local branch with a copy of the PR (assuming it's on GitHub):
git fetch origin pull/PR#/head:branchname
git checkout branchname
2. Do any initial testing that you want -- it should be in the same
state that the submitter left it.
3. "git rebase --interactive develop" to rebase the changes onto the
current develop branch (avoiding a merge commit).
4. Test the new result.
5. Merge the temporary branch into develop. (Optionally with --squash,
if you want to compress multiple commits into one -- but then you have
to remember to commit again afterwards.)
6. Delete the temporary branch.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk