mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-01 20:42:01 +02:00
Polish branches chapter
This commit is contained in:
parent
80c50bdc81
commit
be45b82e41
18 changed files with 231 additions and 191 deletions
levels/merge
|
@ -9,7 +9,7 @@ For example, in this case, one of our clients wants these timelines merged, but
|
|||
|
||||
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.
|
||||
Let your finalized timeline be the "main" one.
|
||||
|
||||
[setup]
|
||||
|
||||
|
@ -39,7 +39,7 @@ git checkout main
|
|||
|
||||
[win]
|
||||
|
||||
# main has a parent, and the grandparent of both its first and child parents are the same commit:
|
||||
# Make a breakfast compromise in the 'main' branch.
|
||||
git rev-parse main^ && test "$(git rev-parse main^1^^)" = "$(git rev-parse main^2^^)"
|
||||
|
||||
[congrats]
|
||||
|
|
|
@ -5,10 +5,6 @@ cards = checkout commit-auto merge
|
|||
|
||||
Here's a trick so that you can sleep a bit longer: just do all your morning activities in parallel universes, and then at the end, merge them together!
|
||||
|
||||
Here, you see three parallel timelines - can you build a situation where you consumed a baguette, a coffee, *and* a donut?
|
||||
|
||||
The "merge" card will help you - try it!
|
||||
|
||||
[setup]
|
||||
|
||||
echo "A friendly old lady.
|
||||
|
@ -79,11 +75,12 @@ You ate a donut." > you
|
|||
git add .
|
||||
git commit -m "You eat the donut"
|
||||
|
||||
git checkout HEAD~2
|
||||
git checkout --detach
|
||||
git branch -D main
|
||||
|
||||
[win]
|
||||
|
||||
# Build a situation where you consumed a baguette, a coffee, *and* a donut.
|
||||
{ git show HEAD:you | grep "You ate.*baguette"; } && { git show HEAD:you | grep "You drank.*coffee"; } && { git show HEAD:you | grep "You ate.*donut"; }
|
||||
|
||||
[congrats]
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
title = Merging timelines
|
||||
cards = checkout commit-auto merge
|
||||
title = Abort a merge
|
||||
cards = checkout commit-auto merge merge-abort
|
||||
|
||||
[description]
|
||||
|
||||
Sometimes you want to merge two commits, nut a merge conflict occurs that you currently don't want to resolve.
|
||||
Sometimes you want to merge two commits, but a merge conflict occurs that you currently don't want to resolve.
|
||||
|
||||
In these situations you can abort the merge to merge later. Use
|
||||
git merge --abort
|
||||
when you are in a merge process.
|
||||
|
@ -46,7 +47,7 @@ fi
|
|||
test -f .git/secretfile
|
||||
|
||||
# You aborted to merge?
|
||||
test -f .git/secretfile && ! test -f .git/MERGE_HEAD
|
||||
test -f .git/secretfile && ! test -f .git/MERGE_HEAD && ! git rev-parse HEAD^^
|
||||
|
||||
[congrats]
|
||||
|
||||
|
|
3
levels/merge/sequence
Normal file
3
levels/merge/sequence
Normal file
|
@ -0,0 +1,3 @@
|
|||
merge
|
||||
conflict
|
||||
merge-abort
|
Loading…
Add table
Add a link
Reference in a new issue