From: Oleg Broytman Date: Mon, 29 Jan 2024 19:26:22 +0000 (+0300) Subject: Feat: Add `git-current-branch` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=782c2431dc18d5fa00286a3af7d654ba47ad3573;p=git-scripts.git Feat: Add `git-current-branch` List ways to get the current branch name. --- 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