Permalink
Browse files

safe way to get "something to checkout which brings us back here"

  • Loading branch information...
1 parent 3fb9fa9 commit a647e6de5e2a9577a16d8f8f114526644610f4f9 @jh13-wtsi jh13-wtsi committed with May 9, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 bin/git-head
View
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+# Echo to stdout the current branch name, or if we have detached HEAD
+# the commitid
+
+git_current_commit() {
+ {
+ git symbolic-ref -q HEAD ||
+ git rev-parse HEAD ||
+ false
+ } |
+ sed -e 's|^refs/heads/||'
+}
+
+git_current_commit

0 comments on commit a647e6d

Please sign in to comment.