Merging a branch

Joachim Breitner mail at joachim-breitner.de
Thu Oct 16 09:24:10 UTC 2014


Hi,


Am Donnerstag, den 16.10.2014, 08:08 +0000 schrieb Simon Peyton Jones:
> I’d like to completely re-organise the patches before committing to
> HEAD.  How do I do that?  Some kind of rebase?   Clearly I want to
> start from current HEAD, rather than having weird merge patches
> involved. 
>
> I was thinking of starting a new branch and doing a manual diff/patch,
> but that seems crude.

Not too crude, if your new set of (logically interesting) patches is
going to be completely different from your original set of (historically
grown) patches.

Here is one workflow for that:
(aren’t you glad that you get so many different suggestions :-)

$ git checkout master

# We first create a branch that contains the final state of the files
# that you will like to push
$ git checkout -b tmp-merge-branch
$ git merge wip/new-flatten-skolems-Aug14
# resolve your conflicts here, once

# now you have a branch with your desired final state, but a messy 
# history. We now create multiple nice patches from that state that,
# together, yield the same result:
$ git checkout master
$ git checkout --patch tmp-merge-branch
# now you can interactively select portions from your patch. Select 
# those that you want in your first polished commit
$ emacs .... # do any additional cleanup of this commit, if required
$ git commit -a -m 'First patch'
$ git checkout --checkout tmp-merge-branch
# Select parts for the second commit
$ emacs .... # do any additional cleanup of this commit, if required
$ git commit -a -m 'Second patch'
... repeat ...
# (in the final "git checkout --patch", you should have selected all
# changes)

# now master is identical to tmp-merge-branch, check this using
$ git diff master..tmp-merge-branch
$ git branch -D tmp-merge-branch
$ git push origin master



Greetings,
Joachim


-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20141016/cb98d6fc/attachment.sig>


More information about the ghc-devs mailing list