Skip to content

Instantly share code, notes, and snippets.

@scottrogowski
Created March 26, 2015 16:01
Show Gist options
  • Save scottrogowski/398ea7e3d5b231b817c5 to your computer and use it in GitHub Desktop.
Save scottrogowski/398ea7e3d5b231b817c5 to your computer and use it in GitHub Desktop.
Set a note on the current git branch using command line arguments
#!/usr/bin/env python
# Set a note on the current git branch using command line arguments
# Usage: note this branch is broken
import sys
import subprocess
import json
if __name__ == '__main__':
branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD".split()).strip()
note = ' '.join(sys.argv[1:])
cmd = "git config branch.%s.note" % (branch)
subprocess.check_output(cmd.split() + [note])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment