Skip to content

Instantly share code, notes, and snippets.

@PhilipOakley
Created August 26, 2016 21:07
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 PhilipOakley/58f344f910e50b72f5a8a2bd55b6c175 to your computer and use it in GitHub Desktop.
Save PhilipOakley/58f344f910e50b72f5a8a2bd55b6c175 to your computer and use it in GitHub Desktop.
# Steps to reproduce the extended example from
# http://stackoverflow.com/q/39144006/1468366
git init .
echo a > txt
git add txt
git commit -m a
echo a > txt; git commit -a -m a
echo b > txt; git commit -a -m b
git checkout -b side :/a
echo z > txt; git commit -a -m z
git checkout master
git merge :/z; echo c > txt; git add -u; git commit -m c
#echo c > txt; git commit -a -m c
echo d > txt; git commit -a -m d
echo e > txt; git commit -a -m e
git checkout -b 2nd :/b
echo i > txt; git commit -a -m i
echo j > txt; git commit -a -m j
git merge :/d; echo k > txt; git add -u; git commit -m k
git checkout -b 3rd :/i
echo n > txt; git commit -a -m n
echo o > txt; git commit -a -m o
echo p > txt; git commit -a -m p
git checkout 2nd
git merge :/p; echo l > txt; git add -u; git commit -m l
echo m > txt; git commit -a -m m
git checkout master
git merge :/l; echo f > txt; git add -u; git commit -m f
git merge :/m; echo g > txt; git add -u; git commit -m g
echo h > txt; git commit -a -m h
git log --oneline --first-parent --merges --reverse --ancestry-path :/j.. | head -5
# why does this not work --ancestry-path and --first-parent appear to clash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment