Skip to content

[FOSS] TASK-01: Resolve a Merge Conflict (First Year Only)Β #31

@23abdul23

Description

@23abdul23

FOSS β€” First Issue πŸš€

Issue Type

FOSS · Beginner · Open for All 🌍

Contribution Rules βœ…

  • Branch: foss only
  • Original content only (No AI usage, otherwise Straight PR Rejection)

Objective

To understand how merge conflicts happen and how to correctly resolve them in real open-source workflows. (foss Branch)


Setup

Create a folder with your GitHub Username inside the task-01 folder.
Inside your GithubId folder, create a file named data.txt with the following content:

OpenCode FOSS Wing – Merge Conflict Task

Line 1: Learning real-world Git workflows.
Line 2: This line will be modified differently in two branches.
Line 3: Git conflicts are normal in open source.
Line 4: I am learning how to resolve them properly.

1. Edit in the original foss branch

Switch to foss branch:

git checkout foss

Edit Line 2 in data.txt to:

This line is modified in the foss branch.

Commit:

git commit -am "Modified line 2 in foss branch"

2. Create Branch A and edit

Create and switch:

git checkout -b foss-task01-a

Edit Line 2 to:

This line is modified in Branch A.

Commit:

git commit -am "Branch A change"

3. Switch back to foss and edit again

git checkout foss

Edit Line 2 to:

This line is modified again in foss branch.

Commit:

git commit -am "Second change in foss branch"

4. Create the conflict

git merge foss-task01-a

5. Resolve the conflict

Resolve Line 2 to:

This line is modified in Branch A and foss branch.

Then commit:

git add data.txt
git commit -m "Resolved merge conflict in data.txt"

6. Push to foss

git push origin foss

Take a screenshot and attach it in your Pull Request description.


PR Submission

  • data.txt exists
  • Conflict is resolved correctly
  • Screenshot attached
  • Commit history shows both branches and merge commit

Answer the following question in your own Language in PR Description

  1. What was the differnece between git commit -m "..." and git commit -am "...".
  2. What was the main cause for the merge conflict according to you?

Pull Request Rejection Criteria ❌

  • Wrong branch
  • Unauthorized changes
  • Incomplete/inaccurately solved issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Points: 20open-for-allAny one can work on it without getting assigned, every PR can merge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions