aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorBrian Fontenot <fontenotbrian@gmail.com>2013-06-01 00:27:24 -0500
committerBrian Fontenot <fontenotbrian@gmail.com>2013-06-01 00:27:24 -0500
commit6df9c595ad8e473d15a81a9291e891476bc833c2 (patch)
treeecfa666a05fb2b481b733cf7f6d770edf47fdc9c /guides/source
parent861ec91e8c681302cec76d9bce278da829e85df1 (diff)
downloadrails-6df9c595ad8e473d15a81a9291e891476bc833c2.tar.gz
rails-6df9c595ad8e473d15a81a9291e891476bc833c2.tar.bz2
rails-6df9c595ad8e473d15a81a9291e891476bc833c2.zip
Add detailed steps on how to squash multiple commits into a single detailed commit
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/contributing_to_ruby_on_rails.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 0be9bb1ced..035db93a1a 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -325,6 +325,31 @@ You can also add bullet points:
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
+For example, to squash the previous three commits into one commit with a detailed commit message:
+
+```bash
+$ git rebase -i HEAD~3
+```
+
+Your editor will now open with the previous 3 commits listed:
+
+```
+pick 7ac1d4 description of first commit message
+pick 2b5aa3 description of second commit message
+pick da472c description of third commit message
+```
+
+Now squash the commits into the first commit
+
+```
+pick 7ac1d4 description of first commit message
+squash 2b5aa3 description of second commit message
+squash da472c description of third commit message
+```
+
+Ater saving and closing the editor, a new editor will open giving you the opportunity to write a detailed commit message for the newly squashed commit.
+
+
### Update Your Branch
It’s pretty likely that other changes to master have happened while you were working. Go get them: