mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-24 13:21:57 +00:00
git: use master
if it exists, otherwise use main
See https://github.com/ohmyzsh/ohmyzsh/pull/9049#issuecomment-654537347 Co-authored-by: Yufan You <ouuansteve@gmail.com>
This commit is contained in:
parent
d79941b789
commit
1db79f97f5
2 changed files with 6 additions and 6 deletions
|
@ -183,8 +183,8 @@ plugins=(... git)
|
||||||
|
|
||||||
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
|
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
|
||||||
a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
|
a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
|
||||||
that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the
|
that any aliases and functions that previously used `master`, will use `main` if `master` doesn't exist. We do this via
|
||||||
function `git_main_branch`.
|
the function `git_main_branch`.
|
||||||
|
|
||||||
### Deprecated aliases
|
### Deprecated aliases
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
|
||||||
| current_branch | Return the name of the current branch |
|
| current_branch | Return the name of the current branch |
|
||||||
| git_current_user_name | Returns the `user.name` config value |
|
| git_current_user_name | Returns the `user.name` config value |
|
||||||
| git_current_user_email | Returns the `user.email` config value |
|
| git_current_user_email | Returns the `user.email` config value |
|
||||||
| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
| git_main_branch | Returns the name of the main branch: `master` if it exists, `main` otherwise |
|
||||||
|
|
||||||
### Work in Progress (WIP)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,10 @@ function work_in_progress() {
|
||||||
|
|
||||||
# Check if main exists and use instead of master
|
# Check if main exists and use instead of master
|
||||||
function git_main_branch() {
|
function git_main_branch() {
|
||||||
if [[ -n "$(git branch --list main)" ]]; then
|
if [[ -n "$(git branch --list master)" ]]; then
|
||||||
echo main
|
|
||||||
else
|
|
||||||
echo master
|
echo master
|
||||||
|
else
|
||||||
|
echo main
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue