Skip to content

Instantly share code, notes, and snippets.

@jmeridth
Created March 24, 2010 02:58
Show Gist options
  • Save jmeridth/341940 to your computer and use it in GitHub Desktop.
Save jmeridth/341940 to your computer and use it in GitHub Desktop.
git revert after merge
~/test > git init && touch hello && git add hello && git commit -m "add hello" && touch hello2 && git add hello2 && git commit -m "add hello2" && touch hello3 && git add hello3 && git commit -m "add hello3" && git checkout -b otherbranch && touch hello4 && git add hello4 && git commit -m "add hello4" && touch hello5 && git add hello5 && git commit -m "add hello5"
Initialized empty Git repository in /Users/jmeridth/test/.git/
[master (root-commit) 58ec117] add hello
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello
[master c295b30] add hello2
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello2
[master 4d9730e] add hello3
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello3
Switched to a new branch 'otherbranch'
[otherbranch 81ed0da] add hello4
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello4
[otherbranch 4f90cca] add hello5
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello5
~/test(otherbranch) > git log
commit 4f90cca2b056fa1672292192503cb4d9cf960c97
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello5
commit 81ed0dadf9f01afde682c8356039b37a6077d1a8
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello4
commit 4d9730e845718870e9edfd9f606e383a99664a9b
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello3
commit c295b3034bf724c684aa1b72683167f9de411def
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello2
commit 58ec11735447ed82c96a5be18bc4604685ab839c
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello
~/test(otherbranch) > git checkout master
Switched to branch 'master'
~/test(master) > git merge otherbranch
Updating 4d9730e..4f90cca
Fast-forward
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello4
create mode 100644 hello5
~/test(master) > git log
commit 4f90cca2b056fa1672292192503cb4d9cf960c97
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello5
commit 81ed0dadf9f01afde682c8356039b37a6077d1a8
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello4
commit 4d9730e845718870e9edfd9f606e383a99664a9b
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello3
commit c295b3034bf724c684aa1b72683167f9de411def
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello2
commit 58ec11735447ed82c96a5be18bc4604685ab839c
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:08 2010 -0600
add hello
~/test(master) > git revert HEAD^
Finished one revert.
[master dacca07] Revert "add hello4"
0 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 hello4
~/test(master) > git log
commit dacca076c9456e86f52643eadd891cb8c64d1c34
Author: Jason Meridth <[email protected]>
Date: Tue Mar 23 21:56:45 2010 -0600
Revert "add hello4"
This reverts commit 81ed0dadf9f01afde682c8356039b37a6077d1a8.
commit 4f90cca2b056fa1672292192503cb4d9cf960c97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment