Practice merging techniques (merge vs rebase)
- Students fork the repository
- Analyze each branch (commits, files, content)
check all branches at once
# Check main branch git switch main git log --oneline # Check lunch branch git switch lunch git log --oneline # Check dinner branch git switch dinner git log --oneline # Check dessert branch git switch dessert git log --oneline
git log --oneline --all --graph
- Go to main-merge branch
git switch main-merge
- Perform a simple merge from the lunch branch
git merge lunch
- Review the merge result
- Perform a merge using the
--no-commit
optiongit merge --no-commit dinner
- Review the result of the new merge
git status git log --oneline
- What's the difference between the two merges?
git commit -am"Merge with dinner with --no-commit option"
- Students fork the repository
- Analyze each branch (commits, files, content)
- Perform a rebase in the dessert branch
git switch dessert git log --oneline git rebase main-merge
- Review the rebase result
git status git log --oneline
Review results and differences, discuss appropriate scenarios for each case