Skip to content

Instantly share code, notes, and snippets.

@calid
Last active March 16, 2016 19:58
Show Gist options
  • Save calid/b2b9b3eb590e151516f0 to your computer and use it in GitHub Desktop.
Save calid/b2b9b3eb590e151516f0 to your computer and use it in GitHub Desktop.
rebase -i example
desktop ~/tmp/gitplay
[✓]▶ git init
Initialized empty Git repository in /Users/dylan.cali/tmp/gitplay/.git/
desktop (master #) ~/tmp/gitplay
[✓]▶ echo ohhai > foo
desktop (master #?) ~/tmp/gitplay
[✓]▶ git add foo
desktop (master #) ~/tmp/gitplay
[✓]▶ git commit -m 'add foo'
[master (root-commit) 7b57f08] add foo
1 file changed, 1 insertion(+)
create mode 100644 foo
desktop (master) ~/tmp/gitplay
[✓]▶ echo ohhai >> foo
desktop (master -) ~/tmp/gitplay
[✓]▶ git commit -am 'add another ohhai line'
[master 34463e4] add another ohhai line
1 file changed, 1 insertion(+)
desktop (master) ~/tmp/gitplay
[✓]▶ echo ohhai >> foo
desktop (master -) ~/tmp/gitplay
[✓]▶ git commit -am 'and yet another ohhai line'
[master 52945df] and yet another ohhai line
1 file changed, 1 insertion(+)
desktop (master) ~/tmp/gitplay
[✓]▶ echo ohbye >> foo
desktop (master -) ~/tmp/gitplay
[✓]▶ git commit -am 'add ohbye'
[master 76f0ec6] add ohbye
1 file changed, 1 insertion(+)
desktop (master) ~/tmp/gitplay
[✓]▶ git log
commit 76f0ec61c20df0cab4ac6298257a29b9943073b8
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:49:35 2016 -0400
add ohbye
commit 52945df35a24cc93d95caf41484a44bca468267a
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:48:28 2016 -0400
and yet another ohhai line
commit 34463e4138276c5063ba6e5ac2eaac50755097c3
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:48:12 2016 -0400
add another ohhai line
commit 7b57f083c77cc3ecb71be6325d9d1c3c95697837
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:47:57 2016 -0400
add foo
desktop (master) ~/tmp/gitplay
[✓]⚑ git rebase -i HEAD~3
pick 34463e4 add another ohhai line
s 52945df and yet another ohhai line
pick 76f0ec6 add ohbye
# Rebase 7b57f08..76f0ec6 onto 7b57f08 (3 command(s))
#
# 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
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
--> SAVE QUIT, BRINGS UP COMMIT DIALOG:
# This is a combination of 2 commits.
# The first commit's message is:
add another ohhai line
# This is the 2nd commit message:
and yet another ohhai line
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Wed Mar 16 15:48:12 2016 -0400
#
# interactive rebase in progress; onto 7b57f08
# Last commands done (2 commands done):
# pick 34463e4 add another ohhai line
# s 52945df and yet another ohhai line
# Next command to do (1 remaining command):
# pick 76f0ec6 add ohbye
# You are currently editing a commit while rebasing branch 'master' on '7b57f08'.
#
# Changes to be committed:
# modified: foo
#
--> CHANGE COMMIT MESSAGE TO 'add some ohhai lines' AND SAVE
desktop (master) ~/tmp/gitplay
[✓]⚑ git rebase -i HEAD~3
[detached HEAD 4191b91] add some ohhai lines
Date: Wed Mar 16 15:48:12 2016 -0400
1 file changed, 2 insertions(+)
Successfully rebased and updated refs/heads/master.
desktop (master) ~/tmp/gitplay
[✓]▶ git log
commit 89f283310faed0e26f5d89f6096b643192882cab
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:49:35 2016 -0400
add ohbye
commit 4191b914a72887c6fc6f2c1f59fdbc4ae21d3772
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:48:12 2016 -0400
add some ohhai lines
commit 7b57f083c77cc3ecb71be6325d9d1c3c95697837
Author: Dylan Cali <[email protected]>
Date: Wed Mar 16 15:47:57 2016 -0400
add foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment