合并冲突是如何产生的?

How are merge conflicts are created?

出于教育 (Q.A.) 目的,我正在创建一系列 git 编码练习,迫使学生以不同的方式创建合并冲突并练习解决它们。

我想知道是否还有其他常见的方式,甚至是不常见的方式,例如工作藏匿、锁定文件等

相似资源(不重复):

一种自动化方法是 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