Created
March 23, 2012 16:57
-
-
Save drench/2172756 to your computer and use it in GitHub Desktop.
git-rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| case "$1" in | |
| put) | |
| hash=`git hash-object -w --stdin` | |
| if [ -z $2 ]; then | |
| echo $hash | |
| else | |
| git tag $2 $hash | |
| fi | |
| ;; | |
| get) | |
| if [ -z $2 ]; then | |
| echo "Missing tagname argument!" | |
| exit 111 | |
| fi | |
| git cat-file blob $2 | |
| ;; | |
| delete) | |
| if [ -z $2 ]; then | |
| echo "Missing object name argument!" | |
| exit 111 | |
| fi | |
| git tag -d $2 | |
| ;; | |
| *) | |
| echo "usage: git rest [put|get|delete] tagname" | |
| ;; | |
| esac |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for creating, reading, and destroying arbitrary objects (blobs) in the git filesystem. These objects are not part of any branch or "working tree".
Example: