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

Git merge unclear #1063

Open
sant3e opened this issue Apr 4, 2023 · 2 comments
Open

Git merge unclear #1063

sant3e opened this issue Apr 4, 2023 · 2 comments

Comments

@sant3e
Copy link

sant3e commented Apr 4, 2023

I apologize for creating this issue here, but could not find any Contact

I struggle with the Git Merge lesson.
The interactive exercise was clear enough (goal and steps), but the actual lesson was not clear enough (to me)
After the initial git merge bugFix we see that main has a new commit (C4) that stems from C2 and C3. The HEAD is also attached to main (the image has different colors for C0, C1, C2 and C3, C4)
It was clear up to this point that this is what we must do to merge bugFix into main. This is also consistent with the interactive exercise

But ... now comes some further insights:
git checkout bugFix;
git merge main;

... which starts to explain something about the colors of the branches.
Here is where you lost me completely.

What i got from this:

  • if you go with git merge bugFix;, something happens;
  • if you go with git merge bugFix; git checkout bugFix; git merge main;, something else happens

As the interactive exercise has only git merge bugFix (and not git merge main also) i do not understand what was supposed to happen here

@FaithfulDev
Copy link

FaithfulDev commented Mar 21, 2024

I think what the lesson is trying to show, is that "git merge" always merges into the current branch.

image

Since before we had "main" checked out, we need to do a "git checkout bugfix" to change that.

Before we merged bugfix into main, we are now merging main into bugfix (the newly checked out branch). Why is everything the same color? In the previous step, we merged information stored on the bugfix branch, giving "main" all the information in bugfix. Now we merge main into bugfix, merging the information (the commit) that was parallel in main, into the bugfix branch. The "cursor" moves forward, since both main and bugfix now have the same history (you can reach every commit from the cursor point).

The question is: How could this be better communicated?

I think the lesson should be more direct in saying that "git merge bugfix" means "merge bugfix into the currently checked-out branch".

@sant3e Do you think that would help in the lesson?

@thiborose
Copy link

I had the exact same thought, and glad to see that i'm not the only one! The color thing has really got me wondering what I was missing.

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

3 participants