Skip to content

Instantly share code, notes, and snippets.

@alecthegeek
Last active August 23, 2020 07:19
Show Gist options
  • Save alecthegeek/b314bb1568610f11fdaac793d8761243 to your computer and use it in GitHub Desktop.
Save alecthegeek/b314bb1568610f11fdaac793d8761243 to your computer and use it in GitHub Desktop.
Git alias for next `git next` to go to next commit. Works on Powershell
# Git alias for next `git next` to go to next commit. Works on Powershell, brobably works on Bash as well.
# Useful for live code demo. See https://blog.jayway.com/2015/03/30/using-git-commits-to-drive-a-live-coding-session
# Info about mapfile from https://www.computerhope.com/unix/bash/mapfile.htm
# Needed because Git on Windows does not have access to tail (by default)
next = "!$SHELL -c 'git checkout $(mapfile -t < <(git rev-list HEAD..demo-end);echo -n ${MAPFILE[-1]})'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment