{"componentChunkName":"component---src-templates-post-jsx","path":"/blog/008-clean-pull-requests/","result":{"data":{"markdownRemark":{"html":"<p>Sometimes you forget to branch off master. Sometimes you need to branch off something besides master, but only want to PR some of your changes (like if a critical error was fixed on a branch but hasn’t been pulled into master yet).</p>\n<p>For me, cherry-picking is critical to ensuring super clean pull requests.</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">git checkout master\ngit checkout -b feature/clean-feature-branch\ngit cherry-pick f1b62817d9^..98d2bba6d0\ngit push origin feature/clean-feature-branch</code></pre></div>\n<p>Essentially what we want to do is create a fresh branch off master, or whichever branch you will request to be merged into (which may be a feature branch if the feature has not been completed). Then cherry-pick the commits you want. In this example, we used a range starting from (and including) <code class=\"language-text\">f1b62817d9</code> through commit <code class=\"language-text\">98d2bba6d0</code>. The <code class=\"language-text\">^</code> denotes that the specified commit is included, otherwise the commit AFTER the specified commit is the first commit included. We could also cherry-pick a single commit with <code class=\"language-text\">git cherry-pick f1b62817d9</code>.</p>\n<p>After all that, you can push your branch. You can also merge your feature branch into your desired PR branch locally (don’t commit it!) if you want to ensure that you don’t have any merge conflicts. The easier your PR is to merge, the better.</p>","timeToRead":1,"excerpt":"Sometimes you forget to branch off master. Sometimes you need to branch off something besides master, but only want to PR some of your…","frontmatter":{"title":"Clean Pull Requests with Git","cover":"https://images.unsplash.com/photo-1517694712202-14dd9538aa97?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=3300&q=80","date":"2017-01-24","category":"tutorial","tags":["osx","workflow"]},"fields":{"slug":"/blog/008-clean-pull-requests/","date":"2017-01-24T07:00:00.000Z"}}},"pageContext":{"slug":"/blog/008-clean-pull-requests/"}}}