-1

For educational (Q.A.) purposes, I'm creating a series of git coding exercises that force students to create a merge conflicts in different ways and practice solving them.

I'm wondering if there are other ways common, or even uncommon ways such as working stash, locked files, etc.

Similar Resources (not duplicates):

HansDev
  • 54
  • 10

1 Answers1

1

One way to automate this is with bash:

#!/bin/bash
mkdir git-repo
cd git-repo
git init
touch my_code.sh
git add my_code.sh
echo "echo Hello" > my_code.sh
git commit -am 'initial'
git checkout -b new_branch
echo "echo \"Hello World\"" > my_code.sh
git commit -am 'first commit on new_branch'
git checkout master
echo "echo \"Hello World!\"" > my_code.sh
git commit -am 'second commit on master'
git merge new_branch
LawCurious
  • 126
  • 2