pcottle / learnGitBranching

An interactive git visualization and tutorial. Aspiring students of git can use this app to educate and challenge themselves towards mastery of git!
https://pcottle.github.io/learnGitBranching/
MIT License
30.4k stars 5.74k forks source link

Color changes and commands on second and third chapter #1040

Closed kampiamodikuesto closed 1 year ago

kampiamodikuesto commented 1 year ago

hi, i have notice that something doesn't work with color on second and third part (branch and merge). Colors don't seem to change in according on what text says. This are commands to reproduce the issue:

If we execute this command into the sandbox we get a different "color" results.

pcottle commented 1 year ago

What do you mean by color? The particular color of branches doesn't have any effect on passing the level, its just a visual aid

kampiamodikuesto commented 1 year ago

i know that colors are aid but i think that they doesn't work as do you write on the text.

In particular i can't understand why when we are in "main" and merge "newImage" (or "bugFix") then "newImage" change color and take the same of the common parent commit.

https://snipboard.io/I6fs2d.jpg

https://snipboard.io/dFVek3.jpg

pcottle commented 1 year ago

Oh so every commit has a "blended" color of all its parent branches. So C12 becomes the blend of the newImage and main colors once the merge happens, so it has the same color as C10

C11 and C13 are only downstream of main, so they take on the main color

kampiamodikuesto commented 1 year ago

i'm sorry if i continue to ask. "the blend of the newImage and main color once the marge happens" shouldn't to be applied to C13? shouldn't all be orange execept C12 that should remain green? And all become orange after "git merge main"?

i make a visual summary image to be more clear https://snipboard.io/ZeYu2c.jpg More about "branch", why color change an all elements (also parent node) in the beginning when we execute a branch? maybe because after he creation of newImage branch, orange is the result of yellow (newImage branch) and fuchsia (main branch) that we can see after the first and second commit?.

pcottle commented 1 year ago

because after he creation of newImage branch, orange is the result of yellow (newImage branch) and fuchsia (main branch) that we can see after the first and second commit?.

yes thats exactly right -- we get a new branch, which has a new color (yellow), so C0 and C1 now get a blended color between main and newImage

The blended color should not apply to C13 once the merge happens, because C13 is only downstream of main. It is not downstream of newImage -- its actually the opposite (newImage is downstream of C13).

The "blended" only goes in one direction, upwards in the tree diagram (aka child descendants, or downstream).

pcottle commented 1 year ago

Anyways from all your screenshots this is working exactly as how I would expect, albeit I understand its a little confusing and never explained explicitly anywhere