Here's a preview from my zine, Oh Shit! Git!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
Suppose you had main
checked out and ran git merge feature-branch
.
If that causes a merge conflict, you’ll see something like this in the files with conflicts:
<<<<<<< HEAD
if x == 0:
return false
=======
(this is the code from main
)
if y == 6:
return true
elif x ==0:
return false
feature-branch
>>> d34367
(this is the code from feature-branch
)
To resolve the conflict:
- Edit the files to fix the conflict
git add
the fixed filesgit diff
–check: check for more conflicts.git commit
when you’re done. (orgit rebase --continue
if you’re rebasing!)
Smiling stick figure with medium length straight hair: You can use a GUI to visually resolve conflicts with git mergetool
. Meld (meldmerge.org) is a great choice!
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!