UCL-MPHY0021-21-22 / RSE-Classwork

7 stars 73 forks source link

Generating and Solving conflicts #3

Open dpshelio opened 3 years ago

dpshelio commented 3 years 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-MPHY0021-21-22/RSE-Classwork#3
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