Skip to content

Instantly share code, notes, and snippets.

@Andrew8xx8
Last active December 13, 2017 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrew8xx8/58319104b9b17e136f0ce7bbdabad1c6 to your computer and use it in GitHub Desktop.
Save Andrew8xx8/58319104b9b17e136f0ce7bbdabad1c6 to your computer and use it in GitHub Desktop.
Git merge fuckup
git init
touch correct.txt broken.txt
git add .
git commit -m "Init commit"
git checkout -b feature
echo 'I need to be here!' >> correct.txt
echo 'I need to be here!' >> broken.txt
git add .
git commit -m "Texts added"
git checkout master
git merge feature
cat correct.txt
cat broken.txt
git log --oneline
git checkout feature
g co HEAD~1 broken.txt
git add .
git commit --amend
cat broken.txt
git checkout master
git merge feature
cat correct.txt
cat broken.txt
git co feature
cat correct.txt
cat broken.txt
git checkout master
git log --oneline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment