git: Fix branch switch alias

Fixed alias `gcb` to switch to a branch if it exists and if not create it.
This commit is contained in:
Marty Oehme 2023-12-12 12:29:40 +01:00
parent 4dadcd5f9f
commit 48ed4818f2
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
1 changed files with 3 additions and 1 deletions

View File

@ -23,7 +23,9 @@ alias gcn!='git commit -v --no-edit --amend'
if version_at_least 2.23 "$git_version"; then
alias gcm='git switch master 2>/dev/null || git switch main'
alias gcd='git switch develop 2>/dev/null || git switch staging'
alias gcb='git switch -c'
gcb() {
git switch "$@" 2>/dev/null || git switch -c "$@"
}
else
alias gcm='git checkout master 2>/dev/null || git checkout main'
alias gcd='git checkout develop'