Skip to content

Instantly share code, notes, and snippets.

@syedjafer
Created February 17, 2023 15:48
Show Gist options
  • Save syedjafer/e91272009b47f4abea71f857396680ad to your computer and use it in GitHub Desktop.
Save syedjafer/e91272009b47f4abea71f857396680ad to your computer and use it in GitHub Desktop.
File to create a merge conflict
# Create a Directory
mkdir git-repo
cd git-repo
# Initialize Git repository
git init
# Create a file
touch my_code.sh
git add my_code.sh
echo "echo Hello" > my_code.sh
git commit -am 'initial'
# Create a new branch
git checkout -b new_branch
echo "echo \"Hello World\"" > my_code.sh
git commit -am 'first commit on new_branch'
# Move to master
git checkout master
echo "echo \"Hello World\!\"" > my_code.sh
git commit -am 'second commit on master'
git merge new_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment