Skip to content

Instantly share code, notes, and snippets.

@sycobuny
Forked from rintaun/merge
Last active December 17, 2015 17:09
Show Gist options
  • Save sycobuny/5643964 to your computer and use it in GitHub Desktop.
Save sycobuny/5643964 to your computer and use it in GitHub Desktop.
sycobuny@valhalla:~/gittest$ git init .
Initialized empty Git repository in /home/sycobuny/gittest/.git/
sycobuny@valhalla:~/gittest$ touch first
sycobuny@valhalla:~/gittest$ git add first
sycobuny@valhalla:~/gittest$ git commit -m "first"
[master (root-commit) be18d08] first
0 files changed
create mode 100644 first
sycobuny@valhalla:~/gittest$ git checkout -b branch
Switched to a new branch 'branch'
sycobuny@valhalla:~/gittest$ touch second
sycobuny@valhalla:~/gittest$ git add second
sycobuny@valhalla:~/gittest$ git commit -m "second"
[branch a7f20eb] second
0 files changed
create mode 100644 second
sycobuny@valhalla:~/gittest$ git checkout master
Switched to branch 'master'
sycobuny@valhalla:~/gittest$ touch third
sycobuny@valhalla:~/gittest$ git add third
sycobuny@valhalla:~/gittest$ git commit -m "third"
[master 53d033e] third
0 files changed
create mode 100644 third
sycobuny@valhalla:~/gittest$ git merge branch
Merge made by the 'recursive' strategy.
0 files changed
create mode 100644 second
sycobuny@valhalla:~/gittest$ git log --pretty=oneline --graph
* 038b5def9b9b6bcd6b6ea53789c9b809746341bc Merge branch 'branch'
|\
| * a7f20eb903671242711d9d63ec178767392cb0cb second
* | 53d033e6a3106d97ab82c514aacec59bdeb6ad2a third
|/
* be18d086fe92e8de239b09f812aa51785433d4a1 first
sycobuny@valhalla:~/gittest$ git log
commit 038b5def9b9b6bcd6b6ea53789c9b809746341bc
Merge: 53d033e a7f20eb
Author: Stephen Belcher <sbelcher@gmail.com>
Date: Fri May 24 09:50:30 2013 -0500
Merge branch 'branch'
commit 53d033e6a3106d97ab82c514aacec59bdeb6ad2a
Author: Stephen Belcher <sbelcher@gmail.com>
Date: Fri May 24 09:50:25 2013 -0500
third
commit a7f20eb903671242711d9d63ec178767392cb0cb
Author: Stephen Belcher <sbelcher@gmail.com>
Date: Fri May 24 09:49:49 2013 -0500
second
commit be18d086fe92e8de239b09f812aa51785433d4a1
Author: Stephen Belcher <sbelcher@gmail.com>
Date: Fri May 24 09:45:34 2013 -0500
first
sycobuny@valhalla:~/gittest$
sycobuny@valhalla:~/gittest$ git init
Initialized empty Git repository in /home/sycobuny/gittest/.git/
sycobuny@valhalla:~/gittest$ touch first
sycobuny@valhalla:~/gittest$ git add first
sycobuny@valhalla:~/gittest$ git commit -m "first"
[master (root-commit) 35b1bfd] first
0 files changed
create mode 100644 first
sycobuny@valhalla:~/gittest$ git checkout -b branch
Switched to a new branch 'branch'
sycobuny@valhalla:~/gittest$ touch second
sycobuny@valhalla:~/gittest$ git add second
sycobuny@valhalla:~/gittest$ git commit -m "second"
[branch 529e6a0] second
0 files changed
create mode 100644 second
sycobuny@valhalla:~/gittest$ git checkout master
Switched to branch 'master'
sycobuny@valhalla:~/gittest$ touch third
sycobuny@valhalla:~/gittest$ git add .
sycobuny@valhalla:~/gittest$ git commit -m "third"
[master 97cf70a] third
0 files changed
create mode 100644 third
sycobuny@valhalla:~/gittest$ git checkout branch
Switched to branch 'branch'
sycobuny@valhalla:~/gittest$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: second
sycobuny@valhalla:~/gittest$ git checkout master
Switched to branch 'master'
sycobuny@valhalla:~/gittest$ git merge branch
Updating 97cf70a..a69280d
Fast-forward
0 files changed
create mode 100644 second
sycobuny@valhalla:~/gittest$ git log --pretty=oneline --graph
* a69280db37d11e281298e36f535239a123c8780b second
* 97cf70a4b3b3676b9322230e6f975e52014bcbb5 third
* 35b1bfd70d6b0c58ede85331f577c7bce15d679a first
sycobuny@valhalla:~/gittest$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment