Git - Rebase | Merge | Merge --Squash!!!

preview_player
Показать описание
Learn about Git MERGE and REBASE and why you may want to use these commands!!!

My Social Links

Enjoy ;-)
Рекомендации по теме
Комментарии
Автор

Finally! Can't believe this actually made sense. Thanks for the video! :)

CaiCruz
Автор

Nice Joe! Appreciated the examples and comparison between the 3 approaches. Even though the jokes were “corny”, still got me laughing out loud. Keep ‘em coming!

amarisi
Автор

Thank you for the video! Summary:

MERGE

- merge the selected branch into the current branch
- creates automatic merge commit
- shows complete commit history in chronological order

git checkout master
git merge feature
git log --oneline

c93e75e (HEAD -> master) Merge branch 'feature'
eb89cfa (feature) feature file 2
0ffc6c8 master file 1
224a6e2 feature file 1
fbdba34 inital file

MERGE SQUASH

- merge the selected branch into the current branch
- no automatic merge commit
- history of the merged feature branch is missing

git checkout master
git merge feature --squash
git log --oneline

0ffc6c8 (HEAD -> master) master file 1
fbdba34 inital file

REBASE

- rebase the feature branch onto the master branch
- no automatic rebase commit
- contains complete commit history, but the order is changed, commit history of feature branch is appended to master branch history

git checkout feature
git rebase master
git log --oneline

7ab5827 (HEAD -> feature) feature file 2
1c005d6 feature file 1
0ffc6c8 (master) master file 1
fbdba34 inital file

browsepulver
Автор

Merge: use it if I want to have the all logs in chronological order from the target branch and also have an extra "merge commit" in the tree at that merging moment
Merge --squash: use it if I just wanted to have the updates from the target branch but NOT their logs and also NOT wanting to have an extra commit at that moment, then later have a commit to represent my current work (not necessarily a merge commit)
Rebase: use it BEFORE PUSH if I want to have a clean git tree and I'm really sure that my commit messages look meaningful so that the target branch looks easy to read.
Am I right ?

RandomGuy-jvvd