Skip to content

Instantly share code, notes, and snippets.

@quag
Created January 4, 2010 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quag/268353 to your computer and use it in GitHub Desktop.
Save quag/268353 to your computer and use it in GitHub Desktop.
First, check the history before starting.
~/homebrew master $ git log --oneline origin/master..master
e2d12f5 Merge branch 'master' of github.com:jauricchio/homebrew
12d6d0d New formula for cuetools.
4173905 New formula for quilt.
fa5608a New formula for quilt.
07a9d50 New formula for patchutils.
Start a git rebase -i:
~/homebrew master $ git rebase -i origin/master
The $EDITOR will open with the following:
pick 07a9d50 New formula for patchutils.
pick fa5608a New formula for quilt.
pick 12d6d0d New formula for cuetools.
pick 4173905 New formula for quilt.
# Rebase ee7f610..e2d12f5 onto ee7f610
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
Change the "pick" on the 4th line to "squash":
pick 07a9d50 New formula for patchutils.
pick fa5608a New formula for quilt.
pick 12d6d0d New formula for cuetools.
squash 4173905 New formula for quilt.
# Rebase ee7f610..e2d12f5 onto ee7f610
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
Then save the fix and exit the editor. $EDITOR will then be opened again for a new commit comment for combining 12d6d0d and 4173905. The initial commit message will be as follows.
# The first commit's message is:
New formula for cuetools.
# This is the 2nd commit message:
New formula for quilt.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Author: Joe Auricchio <jauricchio@gmail.com>
#
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: Library/Formula/cuetools.rb
#
Delete the "New formula for quilt." line, save and exit the editor.
Check that the two commits have been combined:
~/homebrew master $ git log --oneline origin/master..master
c719dd6 New formula for cuetools.
fa5608a New formula for quilt.
07a9d50 New formula for patchutils.
Now the fixed up history can be pushed out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment