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.52k stars 5.75k forks source link

o/main is not synced when doing `git pull origin main:main` #1124

Closed cirex-web closed 8 months ago

cirex-web commented 8 months ago

Is this supposed to be the case? (testing on actual git seems to have the remote tracking branch synced as well after running the above command) (I also asked on this stackoverflow post that talks about this command)

image

Before: image After: image

pcottle commented 8 months ago

Yep that's the intended behavior when you specify a full set of arguments like that; the very last lesson explains this:

Screenshot 2024-01-13 at 3 25 15 PM Screenshot 2024-01-13 at 3 26 11 PM Screenshot 2024-01-13 at 3 26 35 PM

I'm not entirely sure why git just doesn't automatically update o/main for you in this case (I can't think of a time where you want o/main to diverge from the commits you have locally for the origin version of main) but you can fix it with a single command of git fetch origin main afterwards

cirex-web commented 8 months ago

so is this comment wrong? @pcottle image

pcottle commented 8 months ago

So I think there are a few things going on:

1) is the git simulator currently working as designed for the lessons? Yes, I don't think it's a recent regression or it prevents levels from being completed

2) should pulling always update the origin tracking branch even if you provide an argument? Probably (even if it doesn't in the simulator)

I started this project over a decade ago so it's very likely that either I missed this detail while implementing or maybe old versions of git didn't do this

pcottle commented 8 months ago

Anyways if you can find anything in the docs that confirm this, we can work on implementing the change