Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

how to squash commits in a github pull request

  • Loading branch information...
commit 3b5f2284042f9339f48141b1ab34efc487717a1a 1 parent 8d7c0ac
@steveklabnik authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request.md
View
27 posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request.md
@@ -0,0 +1,27 @@
+---
+title: "How to squash commits in a GitHub pull request"
+date: 2012-11-08 23:13
+---
+
+So you've contributed some code to an open source project, say, Rails. And
+they'd like you to squash all of the commits in your pull request. But you're
+not a git wizard; how do you make this happen?
+
+Normally, you'd do something like this. I'm assuming `upstream` is a git remote
+that is pointing at the official project repository, and that your changes are
+in your 'omgpull' branch:
+
+```
+$ git fetch upstream
+$ git checkout omgpull
+$ git rebase upstream/master
+$ git rebase -i
+
+< choose squash for all of your commits, except the first one >
+< Edit the commit message to make sense, and describe all your changes >
+
+$ git push origin omgpull -f
+```
+
+GitHub will then automatically update your pull request with the new commits.
+Super easy!
Please sign in to comment.
Something went wrong with that request. Please try again.