Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[commiters] Merge properly a PR for a linear history without merge commit

consider an upstream project based on git@github.com:fake-group/fake-project.git

$ git clone git@github.com:fake-group/fake-project.git
$ cd fake-project

show history before

$ git log
commit dbb2b36dc57ac84fb05d6a601dac35f5caf813af
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:52:22 2017 +0200

    [workflow] adding PR template

commit 7eef061048535be408b092a68c7a50125452c3d7
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:42:15 2017 +0200

    doc improve

commit c78bd86c5db0c9880b0d6f5d4034ad27a1656d76
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:04:10 2017 +0200

    doc

commit be4d8278863ed9f215a3c5f10aaaacc5b6a0eafe
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 10:57:26 2017 +0200

    add README

apply a merge for a specified pull request

$ git fetch git@github.com:rstallman/fake-project.git doc/improvement-2
$ git checkout -b rstallman/fake-project-doc/improvement-2 FETCH_HEAD
$ git checkout develop
$ git merge rstallman/fake-project-doc/improvement-2

show history after

$ git log
commit ec97cb6e5c0c224ea59cd59438da7abb6081d2c3
Author: Richard Stallman <rstallman@mail.org>
Date:   Thu Oct 12 12:20:05 2017 +0200

    fix doc

commit 67a00e3faafb12779c434c63170e8a3a3671c287
Author: Richard Stallman <rstallman@mail.org>
Date:   Thu Oct 12 12:13:48 2017 +0200

    doc improve 2
    
commit dbb2b36dc57ac84fb05d6a601dac35f5caf813af
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:52:22 2017 +0200

    [workflow] adding PR template

commit 7eef061048535be408b092a68c7a50125452c3d7
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:42:15 2017 +0200

    doc improve

commit c78bd86c5db0c9880b0d6f5d4034ad27a1656d76
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 11:04:10 2017 +0200

    doc

commit be4d8278863ed9f215a3c5f10aaaacc5b6a0eafe
Author: Hervé Beraud <herveberaud.pro@gmail.com>
Date:   Thu Oct 12 10:57:26 2017 +0200

    add README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment