| | 69 | == Merging to Master for the First Time == |
| | 70 | |
| | 71 | When you are ready to merge either the develop branch (or better a release branch that's forked off from develop), there's a bit of housekeeping to be done |
| | 72 | the first time (assuming your library was originally in SVN) so that future merges proceed smoothly. We're going to create a merge point between |
| | 73 | the develop and master branches so that Git knows the last point the two branches were in synch. Once we've done that Git will perform a merge by |
| | 74 | replaying the commits on develop on top of master, starting from the last known merge: in other words Git will perform the tricky stuff of figuring |
| | 75 | out what to merge for us. |
| | 76 | |
| | 77 | Begin by navigating to the history for your library on Github, starting with branch master, for example the Config library |
| | 78 | [https://github.com/boostorg/config/commits/master can be seen here]. Looking down through the commit history we can see |
| | 79 | that the last merge (In SVN land) was on October 25th 2013: make a note of that date. Now use the dropdown box to |
| | 80 | change the history to point to the develop branch, [https://github.com/boostorg/config/commits/develop Config library can be seen here]. |
| | 81 | As you can see there have been several commits since the date above, the last before that date was on Oct 21st, click on the |
| | 82 | commit message for that change to take you to the actual diff for that change, [https://github.com/boostorg/config/commit/67f6b934f161dc5da2039004986a14d9217afae4 in our example here]. The SHA1 for that commit is shown below and to the right of the commit message, in this case it's |
| | 83 | {{{67f6b934f161dc5da2039004986a14d9217afae4}}}. |
| | 84 | |
| | 85 | Now we'll create a merge to the specific commit, begin by changing your library to the master branch: |
| | 86 | |
| | 87 | {{{ |
| | 88 | git checkout master |
| | 89 | }}} |
| | 90 | |
| | 91 | Now create a merge to the specific commit above: since we don't really want to actually change the master branch we'll use the |
| | 92 | {{{-s ours}}} option to avoid any conflicts: |
| | 93 | |
| | 94 | {{{ |
| | 95 | git merge --no-ff --no-commit -s ours 67f6b934f161dc5da2039004986a14d9217afae4 |
| | 96 | }}} |
| | 97 | |
| | 98 | You can now use {{{git status}}} and {{{git diff}}} to check for modifications, in this case there are none. |
| | 99 | Now make the commit: |
| | 100 | |
| | 101 | {{{ |
| | 102 | git commit -am "Create first merge point for Git" |
| | 103 | }}} |
| | 104 | |
| | 105 | And finish off by pushing your changes to Github |
| | 106 | |
| | 107 | {{{ |
| | 108 | git push |
| | 109 | }}} |
| | 110 | |
| | 111 | Then navigate to your libraries history again, and check that the merge shows up, [https://github.com/boostorg/config/commits/master our config example is here]. |
| | 112 | You're now ready for "routine" merges to proceed as per Gitflow (or whatever other strategy you wish to use). |