From 782c2431dc18d5fa00286a3af7d654ba47ad3573 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 29 Jan 2024 22:26:22 +0300 Subject: [PATCH] Feat: Add `git-current-branch` List ways to get the current branch name. --- git-current-branch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 git-current-branch diff --git a/git-current-branch b/git-current-branch new file mode 100755 index 0000000..19cedf4 --- /dev/null +++ b/git-current-branch @@ -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 -- 2.39.5