oh-my-git/levels/merge/conflict

48 lines
1.4 KiB
Text
Raw Normal View History

2020-10-22 16:19:22 +02:00
title = Contradictions
2020-10-29 20:02:43 +01:00
cards = checkout commit-auto merge reset-hard
2020-10-22 16:19:22 +02:00
[description]
2020-10-22 17:27:54 +02:00
Sometimes, timelines will contradict each other.
For example, in this case, one of our clients wants these timelines merged, but they ate different things for breakfast in both timelines.
Try to merge them together! You'll notice that there will be a conflict! The time machine will leave it up to you how to proceed: you can edit the problematic item, it will show you the conflicting sections. You can keep either of the two versions - or create a combination of them! Remove the >>>, <<<, and === markers, and make a new commit to finalize the merge!
Again, let your finalized timeline be the "main" one.
[setup]
echo "Just woke up. Is hungry." > sam
git add .
git commit -m "The beginning"
git checkout -b pancakes
echo "Had blueberry pancakes with maple syrup for breakfast." > sam
git add .
git commit -m "Pancakes!"
2020-10-22 17:27:54 +02:00
echo "
Is at work." >> sam
2020-10-22 17:27:54 +02:00
git commit -am "Go to work"
git checkout -b muesli main
echo "Had muesli with oats and strawberries for breakfast." > sam
git add .
git commit -m "Muesli!"
2020-10-22 17:27:54 +02:00
echo "
Is at work." >> sam
2020-10-22 17:27:54 +02:00
git commit -am "Go to work"
git checkout main
[win]
2020-10-22 17:27:54 +02:00
# main has a parent, and the grandparent of both its first and child parents are the same commit:
git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)"
[congrats]
Yum, that sounds like a good breakfast!