Skip to content

Instantly share code, notes, and snippets.

@mattneub
Created March 20, 2020 00:39
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 mattneub/46b193eed0089f0870386400e52ab19a to your computer and use it in GitHub Desktop.
Save mattneub/46b193eed0089f0870386400e52ab19a to your computer and use it in GitHub Desktop.
git init foo
cd foo
touch this that
git add .
git commit -m '1 master'
git checkout -b feature
echo 'feature' > this
git commit -a -m '1 feature'
git checkout master
echo 'master' > that
git commit -a -m '2 master'
git merge -m 'Merge feature' feature
echo 'master 2' >> that
git commit -a -m '3 master after merge'
# but now...
echo 'feature 2' >> this
git commit -a -m '4 master two after merge'
cat this that
# feature
# feature 2
# master
# master 2
git rebase -i HEAD^^^^
# remove feature 1
# CONFLICT (content): Merge conflict in this
# so we edit this:
# <<<<<<< HEAD
# =======
# feature
# feature 2
# >>>>>>> c84fea8... 4 master two after merge
# what to do? well, we _might_ wish to keep the content
# let's do that
git add this
git rebase --continue
cat this that
# feature
# feature 2
# master
# master 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment