Screencast: Resolving Merge Conflicts in Git
"It's a great primer on conflict resolution with Git" -- Nate Abele, Lead Developer, CakePHP
"Merging code using *any* version control system can sometimes seem scary. This screencast will show you just how easy it is to have conflict-free merging of your code if you are using Git."-- Chris Hartjes
Cinematic Trailer
Plot
-
The Sample Project
- Description of a simple git repository
- Contains two files, index.html and screen.css
- Source code of files is displayed
- Repository history is shown
-
Getting into a conflict
- File screen.css gets edited
- The changes are commited with git commit
- Pushing them to server (central/origin repository) fails
- Running git pull results in merge conflict
-
How did this happen?
- We go back in time and watch Tim (a collaborator) making changes to the same file
- He commits and pushes the changes
- We see why his change is in conflict with the one I did
-
Resolving the conflict
- The conflicted file is identified (screen.css)
- It is edited and the conflict markers are explained
- The conflict is resolved by keeping the changes Tim made
- Git is being told about the resolved conflict
- The changes are commited and pushed
-
What about rebase?
- The differences between a rebase and a merge operation are explained
- We learn why both operations can result in different conflicts
-
Resolving rebase conflicts
- We go back in time again before git pull caused the conflict
- git pull --rebase is used now used instead
- The result is a merge conflict during a rebase operation
- screen.css is edited again and this time the resolution is to keep my own changes
- Git is being told about the resolved conflict
- The changes are commited and pushed
Specification
| Narrator: | Felix Geisendörfer |
|---|---|
| Duration: | 13:52 min |
| Resolution | 800x600 px |
| Format: | Quicktime (.mov) inside a Zip Archive (.zip) |
| Download Size: | 57.91 MB |