Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git-default-branch-script #53

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading