Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- git init merge_test
- # Initialized empty Git repository in /vagrant/merge_test/.git/
- cd merge_test
- echo "First commit." > a_file
- git commit -am "First commit."
- git log
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c (HEAD -> master)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- git branch feature
- git branch develop
- git checkout feature
- # Switched to branch 'feature'
- echo "Second commit." >> a_file
- git commit -am "Second commit."
- git log
- # commit e73018f4843087bd3be23dbb469ffaec8d32ed1d (HEAD -> feature)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:28:32 2017 +0000
- #
- # Second commit.
- #
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c (master, develop)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- git checkout develop
- git merge feature
- Updating eb4173d..e73018f
- # Fast-forward
- # a_file | 1 +
- # 1 file changed, 1 insertion(+)
- git log
- # commit e73018f4843087bd3be23dbb469ffaec8d32ed1d (HEAD -> develop, feature)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:28:32 2017 +0000
- #
- # Second commit.
- #
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c (master)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- # FAST FORWARD MERGE MEANS NO MERGE COMMIT SO HISTORIES ARE IDENTICAL.
- git branch release
- git checkout release
- echo "Third commit." >> a_file
- git commit -am "Third commit."
- git checkout master
- git merge release
- # Fast-forward
- # a_file | 2 ++
- # 1 file changed, 2 insertions(+)
- git log
- # commit a3db5c679d8106c2bc6b2c84680e6c594b6b53bd (HEAD -> master, release)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:35:23 2017 +0000
- #
- # Third commit.
- #
- # commit e73018f4843087bd3be23dbb469ffaec8d32ed1d (feature, develop)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:28:32 2017 +0000
- #
- # Second commit.
- #
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- # ONCE AGAIN A FAST FORWARD MERGE SO NOT DIFFERENCE IN HISTORIES.
- # BUT MEANWHILE DEVELOP HAS PROGRESSED.
- git checkout develop
- echo "Fourth commit." >> a_file
- git commit -am "Fourth commit."
- git merge master
- # Auto-merging a_file
- # CONFLICT (content): Merge conflict in a_file
- # Automatic merge failed; fix conflicts and then commit the result.
- # MERGE CONFLICT BECAUSE SAME LINE WAS CHANGED.
- cat a_file
- # First commit.
- # Second commit.
- # <<<<<<< HEAD
- # Fourth commit.
- # =======
- # Third commit.
- # >>>>>>> master
- # CURRENTLY ON DEVELOP SO 'HEAD' REPRESENTS CHANGED ON THAT BRANCH.
- # RESOLVE MERGE CONFLICTS...
- cat a_file
- # First commit.
- # Second commit.
- # Third commit.
- # Fourth commit.
- git commit -a
- git log
- # commit 761bf516a89ae8ff71c179b26d5bf8f5904e2c7b (HEAD -> develop)
- # Merge: a8080f0 a3db5c6
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:45:40 2017 +0000
- #
- # Merge branch 'master' into develop
- #
- # commit a8080f05208451b8defc705ae153259cde415d68
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:39:05 2017 +0000
- #
- # Fourth commit.
- #
- # commit a3db5c679d8106c2bc6b2c84680e6c594b6b53bd (release, master)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:35:23 2017 +0000
- #
- # Third commit.
- #
- # commit e73018f4843087bd3be23dbb469ffaec8d32ed1d (feature)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:28:32 2017 +0000
- #
- # Second commit.
- #
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- # GIT LOG IS IN CORRECT ORDER BUT HISTORIES HAVE NOW DIVERGED BECAUSE DEVELOP HAS AN EXTRA 'MERGE COMMIT'.
- # NOW MERGE BACK INTO MASTER.
- git branch release-two
- git checkout release-two
- echo "Fifth commit." >> a_file
- git commit -am "Fifth commit."
- git checkout master
- git merge release-two
- # Fast-forward
- # a_file | 2 ++
- # 1 file changed, 2 insertions(+)
- # MEANWHILE ON DEVELOP FILE HAS CHANGED AGAIN BUT NOT THE SAME LINE THIS TIME.
- git checkout develop
- vim a_file
- cat a_file
- # 1st commit.
- # Second commit.
- # Third commit.
- # Fourth commit.
- git commit -am "Sixth commit."
- git merge master
- # FILE OPENS FOR SAVING WITH MERGE COMMIT MESSAGE PRE-POPULATED. SAVE.
- # Auto-merging a_file
- # Merge made by the 'recursive' strategy.
- # a_file | 1 +
- # 1 file changed, 1 insertion(+)
- # THIS TIME IT USED 'RECURSIVE' RATHER THAN 'FAST FORWARD' MERGE STRATEGY.
- git log
- # commit 007d58f791c1585a47a999bcdcc72262e89299f2 (HEAD -> develop)
- # Merge: 709a3cb f1825df
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:55:44 2017 +0000
- #
- # Merge branch 'master' into develop
- #
- # commit 709a3cb6bd09dc6d12102c0813c1003b57fd332a
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:55:12 2017 +0000
- #
- # Sixth commit.
- #
- # commit f1825df7011d7085c8b158ee55461b6f1780bca4 (release-two, master)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:52:25 2017 +0000
- #
- # Fifth commit.
- #
- # commit 761bf516a89ae8ff71c179b26d5bf8f5904e2c7b
- # Merge: a8080f0 a3db5c6
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:45:40 2017 +0000
- #
- # Merge branch 'master' into develop
- #
- # commit a8080f05208451b8defc705ae153259cde415d68
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:39:05 2017 +0000
- #
- # Fourth commit.
- #
- # commit a3db5c679d8106c2bc6b2c84680e6c594b6b53bd (release)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:35:23 2017 +0000
- #
- # Third commit.
- #
- # commit e73018f4843087bd3be23dbb469ffaec8d32ed1d (feature)
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:28:32 2017 +0000
- #
- # Second commit.
- #
- # commit eb4173dbd9589057e4fa0df089de781b33db9f5c
- # Author: vagrant <vagrant@localhost.localdomain>
- # Date: Thu Nov 9 03:19:43 2017 +0000
- #
- # First commit.
- # EVEN THOUGH THERE WERE NO MERGE CONFLICTS A NEW 'MERGE COMMIT' WAS STILL CREATED.
Add Comment
Please, Sign In to add comment