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

git rebase error log history #977

Open LiuShuaiQ opened 2 years ago

LiuShuaiQ commented 2 years ago

Hello, I have a error order history when I use the last tag in main tab.

Here we have main that is a few commits ahead of branches one two and three. For whatever reason, we need to update these three other branches with modified versions of the last few commits on main.

Blow is my git command:

$ git rebase C2 three
$ git checkout one
$ git cherry-pick C4 C3 C2
$ git checkout two
$ git cherry-pick C5
$ git rebase two one
WechatIMG71754

The history of branch one should be:

C2``->C3``->C4``->C5`->C1->C0
pcottle commented 2 years ago

to repro: https://learngitbranching.js.org/?NODEMO&command=level%20advanced3;%20git%20rebase%20C2%20three;%20git%20checkout%20one;%20git%20cherry-pick%20C4%20C3%20C2;%20git%20checkout%20two;%20git%20cherry-pick%20C5;%20git%20rebase%20two%20one

I think this is because we have some code that tries to understand the order of the commits when rebasing, and that unfortunately assumes the chronological order (what you see above) vs the other in the rebase target

I dont think it applies to most lessons because most of the time we arent rebasing out of order

LiuShuaiQ commented 2 years ago

Ok, I don't think this is a general problem, the rebase order of other courses is normal.

Thansks for your reply.