Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong solution in level "Rebasing over 9000 times" #1213

Open
Afelium04 opened this issue Dec 25, 2024 · 2 comments
Open

Wrong solution in level "Rebasing over 9000 times" #1213

Afelium04 opened this issue Dec 25, 2024 · 2 comments

Comments

@Afelium04
Copy link

Afelium04 commented Dec 25, 2024

Hello,
I found your tool really useful so far, but I suspect there may be an error within the solution for the level named "Rebasing over 9000 times":
image

I tried to recreate the same tree in git:

git commit --allow-empty -m C0

git checkout -b side
git commit --allow-empty -m C4
git commit --allow-empty -m C5

git checkout -b another
git commit --allow-empty -m C7

git checkout side
git commit --allow-empty -m C6

git checkout main
git commit --allow-empty -m C1

git checkout -b bugFix
git commit --allow-empty -m C3

git checkout main
git commit --allow-empty -m C2

(made commits in this order so that the git graph comes out similar to the image, please tell me if there's an easier way to change the order the branches are displayed)

then applied the proposed solution:

git rebase main bugFix
git rebase bugFix side
git rebase side another
git rebase another main

but got a different result:
image
(when rebasing another onto side, nodes C4 and C5 are appended a second time).

@pcottle
Copy link
Owner

pcottle commented Dec 25, 2024

I think this actually depends on the version of git you're running -- this project is over a decade old so it matches the git semantics of way back then, not the modern version unfortunately.

What version are you running locally?

Anyways this project is more about learning the concepts that enable you to work in git, so hopefully a few differences are tolerable :)

@Afelium04
Copy link
Author

Hi,
I'm currently running Git version 2.40.0.

I understand that the aim of the project is just to give an introduction to basic git commands, but I believe the inconsistency may lie within the project itself; the earlier level "rebase introduction" stated that:

Rebasing essentially takes a set of commits, "copies" them, and plops them down somewhere else

There! Since main was an ancestor of bugFix, git simply moved the main branch reference forward in history.

My takeaway from these statements was that rebase takes all commits of the current branch up to its common ancestor with the destination branch (which contradicts the proposed solution and matches the behaviour on my machine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants