Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Generating and Solving Conflicts #13

Open
@HChughtai

Description

In this exercise, you will generate a merge conflict and then resolve it. In the process of doing so, you'll practise some of the git commands and concepts that we've covered in the workshop

Exercise

  1. Read the contents of the script below
  2. Write in the commands line by line on your machine trying to understand their purpose as you go
  3. This will create a merge conflict
  4. Resolve the merge conflict so that the text in README.md is "Hello World"
  5. Check the status of your repository to ensure that the working tree is clean
cd Desktop/
mkdir MergeConflict
cd MergeConflict/
git init
touch README.md
echo "Hello" > README.md
git add README.md
git commit -m "first commit on main"
# if your default is not main; rename master with: git branch -m main
git checkout -b new-branch
echo "Hello World" > README.md
git commit -am "first commit on new-branch"
git checkout main
echo "Hola" > README.md
git commit -am "second commit on main: adds something in Spanish"
git merge new-branch

If you finish this exercise quickly - have a look at Practising branches with git (optional)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions