Skip to content

Instantly share code, notes, and snippets.

@anamewing
Created January 19, 2018 13:00
Show Gist options
  • Save anamewing/e220af5b72b0fe92a00a1c6248b20da4 to your computer and use it in GitHub Desktop.
Save anamewing/e220af5b72b0fe92a00a1c6248b20da4 to your computer and use it in GitHub Desktop.
git export ref to json
#!/usr/bin/env bash
git for-each-ref \
--format='{"tag":"%(refname:short)" ,%0a "date":"%(taggerdate)" },' \
refs/tags \
$@ | \
perl -pe 'chomp if eof;BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment