posts:git:notes: show how to tag a file (e.g. junio-gpg-pub)
authorW. Trevor King <wking@tremily.us>
Wed, 5 Dec 2012 17:20:09 +0000 (12:20 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 5 Dec 2012 17:20:09 +0000 (12:20 -0500)
posts/Git/notes.org

index accc19da05c570976d442d9bcf8e4a8074f05aa3..85e1993a147c027eeda888b141b08d445b78bb9c 100644 (file)
@@ -1410,6 +1410,22 @@ For example,
 
     : $ git cat-file blob master:README
 
+** Tag a file (not a commit)
+
+Add the file (e.g. =my-file= to the object database and get it's
+SHA-1:
+
+    : $ git hash-object -w my-file
+    : fe113d3f96636710600c6b02d5fd421fa7e87dd6
+
+Then tag that hash.
+
+    : $ git tag junio-gpg-pub fe113d3f96636710600c6b02d5fd421fa7e87dd6
+
+Combining these into one command using Bash's command substitution:
+
+    : $ git tag junio-gpg-pub $(git hash-object -w my-file)
+
 * Troubleshooting
 ** Git commit hangs with no output