UCL-COMP0233-2023-2024 / RSE-Classwork

3 stars 65 forks source link

Generating and Solving conflicts #4

Open dpshelio opened 1 year ago

dpshelio commented 1 year ago
  1. Read the content of the script below
  2. Run it one by one or as a script on your machine. It will create a merge conflict.
  3. Resolve the merge conflict so the text in README.md is "Hello World".
  4. Make sure your working tree is clean
  5. Create an issue in your fork with a code block showing how the file looks before and after the conflict. Add a link to this issue in the description of your issue as:
    Answers UCL-COMP0233-23-24/RSE-Classwork#4
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 switch -c new-branch
echo "Hello World" > README.md
git commit -am "first commit on new-branch"
git switch main
echo "Hola Mundo" > README.md
git commit -am "second commit on main: translates it into Spanish"
git merge new-branch