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

Generating and Solving Conflicts #13

Open
HChughtai opened this issue Apr 28, 2021 · 0 comments
Open

Generating and Solving Conflicts #13

HChughtai opened this issue Apr 28, 2021 · 0 comments

Comments

@HChughtai
Copy link
Collaborator

HChughtai commented Apr 28, 2021

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)

@HChughtai HChughtai changed the title Generating and Solving conflicts Generating and Solving Conflicts Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant