]> git.phdru.name Git - git-scripts.git/blobdiff - git-current-branch
Feat: Add `git-current-branch`
[git-scripts.git] / git-current-branch
diff --git a/git-current-branch b/git-current-branch
new file mode 100755 (executable)
index 0000000..19cedf4
--- /dev/null
@@ -0,0 +1,14 @@
+#! /bin/sh -x
+# List ways to get the current branch name.
+# Compare the output after "git checkout master" and "git checkout master~1".
+
+git branch --show-current
+git describe --all
+git name-rev --name-only HEAD
+
+git rev-parse --abbrev-ref HEAD
+git rev-parse --symbolic-full-name --abbrev-ref HEAD
+
+git symbolic-ref --short -q HEAD; echo $?
+git symbolic-ref --short HEAD
+git symbolic-ref HEAD