Skip to content

Commit

Permalink
Add git-default-branch-script
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmercer committed Feb 20, 2024
1 parent 5efd3a9 commit 6178b8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions bin/git-checkout-default-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
#
# Checkout default branch
# This assumes that either `master` or `main` is the default

if git show-ref --quiet refs/heads/master; then
git checkout master
elif git show-ref --quiet refs/heads/main; then
git checkout main
else
echo "Neither 'master' nor 'main' branch exists."
fi
2 changes: 1 addition & 1 deletion git/git-alii.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ alias gcl="git clone"
alias gcm="git commit -m"
alias gco="git checkout"
alias gcob="git checkout -b"
alias gcom="git checkout master"
alias gcom="git-checkout-default-branch"
alias gcon="git checkout main"
alias gcp="git cherry-pick"
alias gcpa="git cherry-pick --abort"
Expand Down

0 comments on commit 6178b8c

Please sign in to comment.