Skip to content

Instantly share code, notes, and snippets.

@avk
Created May 31, 2013 19:55
Show Gist options
  • Save avk/5687564 to your computer and use it in GitHub Desktop.
Save avk/5687564 to your computer and use it in GitHub Desktop.
View the past and present state of deployed files in a git repo.
# gitat
# View the past and present state of deployed files in a git repo.
#
# Usage:
# 1. prints file in currently deployed state
# $ gitat path/to/file
# 2. prints version of file deployed on May 20
# $ gitat path/to/file 2013-05-20
# 3. prints context around line 123 in version of file deployed on May 20
# $ gitat path/to/file 2013-05-20 123
gitat () {
git show origin/master@{$2}:$1 | cat -n | grep -C10 "${3}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment