User:Dantman/Git/FastForward-vs-no-ff

From mediawiki.org
Normal Fast-Forward project pattern no-ff project pattern
# Setup the repo
$ git init test
Initialized empty Git repository in /private/tmp/git/test/.git/
$ cd test/
$ echo "a" > code
$ echo "v0.9" > README
$ git add README code
$ git commit -m "Initial commit of the codebase."
[master (root-commit) 9d83f7b] Initial commit of the codebase.
 2 files changed, 2 insertions(+)
 create mode 100644 README
 create mode 100644 code

# Current state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
* 9d83f7b (HEAD, master) Initial commit of the codebase.

# Change a into b and make a release
$ git checkout -b atob
Switched to a new branch 'atob'
$ echo "b" > code
$ git add code
$ git commit -m "Made a into b."
[atob 9a68b95] Made a into b.
 1 file changed, 1 insertion(+), 1 deletion(-)
$ echo "v1.0" > README
$ git add README
$ git commit -m "Now at the first release."
[atob 3f77cbf] Now at the first release.
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git checkout master
Switched to branch 'master'

# Current state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
* 3f77cbf (atob) Now at the first release.
* 9a68b95 Made a into b.
* 9d83f7b (HEAD, master) Initial commit of the codebase.

# Merge the commits into master
$ git merge atob
Updating 9d83f7b..3f77cbf
Fast-forward
 README |    2 +-
 code   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

# Final state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
* 3f77cbf (HEAD, master, atob) Now at the first release.
* 9a68b95 Made a into b.
* 9d83f7b Initial commit of the codebase.
# Setup the repo
$ git init test
Initialized empty Git repository in /private/tmp/git/test/.git/
$ cd test/
$ echo "a" > code
$ echo "v0.9" > README
$ git add README code
$ git commit -m "Initial commit of the codebase."
[master (root-commit) b6b2ca8] Initial commit of the codebase.
 2 files changed, 2 insertions(+)
 create mode 100644 README
 create mode 100644 code

# Current state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
* b6b2ca8 (HEAD, master) Initial commit of the codebase.

# Change a into b and make a release
$ git checkout -b atob
Switched to a new branch 'atob'
$ echo "b" > code 
$ git add code
$ git commit -m "Made a into b."
[atob 1c77b38] Made a into b.
 1 file changed, 1 insertion(+), 1 deletion(-)
$ echo "v1.0" > README
$ git add README
$ git commit -m "Now at the first release."
[atob 91d1139] Now at the first release.
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git checkout master
Switched to branch 'master'

# Current state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
* 91d1139 (atob) Now at the first release.
* 1c77b38 Made a into b.
* b6b2ca8 (HEAD, master) Initial commit of the codebase.

# Merge the commits into master
$ git merge --no-ff atob -m "Make a into b and make a release."
Merge made by the 'recursive' strategy.
 README |    2 +-
 code   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

# Final state of the repo
$ git log --graph --pretty=oneline --abbrev-commit --all --decorate=short
*   5a3117f (HEAD, master) Make a into b and make a release.
|\  
| * 91d1139 (atob) Now at the first release.
| * 1c77b38 Made a into b.
|/  
* b6b2ca8 Initial commit of the codebase.