Skip to content

Instantly share code, notes, and snippets.

@n0mimono
Last active August 29, 2015 14:22
Show Gist options
  • Save n0mimono/30d8d476e3adef69cd9c to your computer and use it in GitHub Desktop.
Save n0mimono/30d8d476e3adef69cd9c to your computer and use it in GitHub Desktop.
git diff HEAD\^ HEAD
#!/usr/bin/python
# -*- coding: utf-8 -*-
from subprocess import call
import sys
if __name__ == '__main__':
if len(sys.argv) == 1:
old_n = 1
new_n = 0
elif len(sys.argv) == 2:
old_n = int(sys.argv[1])
new_n = 0
else:
old_n = int(sys.argv[1])
new_n = int(sys.argv[2])
old_commit = "HEAD" + "^"*old_n
new_commit = "HEAD" + "^"*new_n
call(["git", "diff", old_commit, new_commit])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment