Created
May 27, 2016 05:40
-
-
Save byrney/dad6a6af20536bb61980d838b76b3780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git init | |
# | |
# Make some tests commits on master | |
# | |
$ echo one > one.txt | |
$ git commit -am one | |
$ echo two > two.txt | |
$ echo three >> one.txt | |
$ git commit -am twoandthree | |
$ echo four > two.txt | |
$ git commit -am "oops 4" | |
$ git ll | |
3290abd oops 4 (2 sec..) <Rob..> | |
05f9b46 twoandthree (29 se..) <Rob..> | |
94adca5 one (53 se..) <Rob..> | |
# | |
# create a new branch starting at base commit | |
# | |
$ git checkout -b squash 94adca5 | |
Switched to a new branch 'squash' | |
$ git ll | |
94adca5 one (2 min..) <Rob..> | |
# | |
# merge from master and squash | |
# | |
$ git merge --squash master | |
Updating 94adca5..3290abd | |
Fast-forward | |
Squash commit -- not updating HEAD | |
one.txt | 1 + | |
two.txt | 1 + | |
2 files changed, 2 insertions(+) | |
create mode 100644 two.txt | |
# | |
# this will leave the squashed changes uncommited # | |
$ git s | |
On branch squash | |
Changes to be committed: | |
modified: one.txt | |
new file: two.txt | |
# | |
# commit them | |
# | |
$ git commit -am squashed | |
$ git ll | |
87f593d squashed (2 sec..) <Rob..> | |
94adca5 one (3 min..) <Rob..> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment