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:
parent
4dadcd5f9f
commit
48ed4818f2
1 changed files with 3 additions and 1 deletions
|
@ -23,7 +23,9 @@ alias gcn!='git commit -v --no-edit --amend'
|
||||||
if version_at_least 2.23 "$git_version"; then
|
if version_at_least 2.23 "$git_version"; then
|
||||||
alias gcm='git switch master 2>/dev/null || git switch main'
|
alias gcm='git switch master 2>/dev/null || git switch main'
|
||||||
alias gcd='git switch develop 2>/dev/null || git switch staging'
|
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
|
else
|
||||||
alias gcm='git checkout master 2>/dev/null || git checkout main'
|
alias gcm='git checkout master 2>/dev/null || git checkout main'
|
||||||
alias gcd='git checkout develop'
|
alias gcd='git checkout develop'
|
||||||
|
|
Loading…
Reference in a new issue