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
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
- Read the contents of the script below
- Write in the commands line by line on your machine trying to understand their purpose as you go
- This will create a merge conflict
- Resolve the merge conflict so that the text in README.md is "Hello World"
- 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
Labels
No labels