Skip to content

Instantly share code, notes, and snippets.

@aleszoulek
Created May 6, 2015 08:45
Show Gist options
  • Save aleszoulek/03e1385fe7ba8230e5f0 to your computer and use it in GitHub Desktop.
Save aleszoulek/03e1385fe7ba8230e5f0 to your computer and use it in GitHub Desktop.
rebase is a lie
{repos } git init
Initialized empty Git repository in /home/ales/repos/.git/
{master repos } git ci -am 'initial' --allow-empty
[master (root-commit) 1096524] initial
# feature one commits
{master repos } git co -b feature-1
Switched to a new branch 'feature-1'
{feature-1 repos } touch 1
{feature-1 repos } git add 1
{feature-1 repos } git ci -m 'F1 commit'
[feature-1 9f05656] F1 commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1
# feature two commits
{feature-1 repos } git co master
Switched to branch 'master'
{master repos } git co -b feature-2
Switched to a new branch 'feature-2'
{feature-2 repos } touch 2
{feature-2 repos } git add 2
{feature-2 repos } git ci -m 'F2 commit'
[feature-2 0af30f5] F2 commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 2
# merge feature two into master
{feature-2 repos } git co master
Switched to branch 'master'
{master repos } git merge feature-2
Updating 1096524..0af30f5
Fast-forward
2 | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 2
# rebase feature one
{master repos } git co feature-1
Switched to branch 'feature-1'
# check history timestamps
{feature-1 repos } git l
commit 5d5b240180a5b62c47227472c82ca85a998edc4c
Author: Ales Zoulek <ales.zoulek@gmail.com>
Date: Wed May 6 10:41:48 2015 +0200
F1 commit
commit 0af30f55a683bade76d969dbc75c67e408b27089
Author: Ales Zoulek <ales.zoulek@gmail.com>
Date: Wed May 6 10:42:12 2015 +0200
F2 commit
commit 10965247a2c11181ccb5af93049a0020bb39d11e
Author: Ales Zoulek <ales.zoulek@gmail.com>
Date: Wed May 6 10:40:44 2015 +0200
initial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment