Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
1db79f97
Commit
1db79f97
authored
Jul 09, 2020
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
>
parent
d79941b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
README.md
plugins/git/README.md
+3
-3
git.plugin.zsh
plugins/git/git.plugin.zsh
+3
-3
No files found.
plugins/git/README.md
View file @
1db79f97
...
...
@@ -183,8 +183,8 @@ plugins=(... git)
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
that any aliases and functions that previously used
`master`
, will use
`main`
if
that branch exists. We do this via the
function
`git_main_branch`
.
that any aliases and functions that previously used
`master`
, will use
`main`
if
`master`
doesn't exist. We do this via
the
function
`git_main_branch`
.
### 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 |
| git_current_user_name | Returns the
`user.name`
config value |
| git_current_user_email | Returns the
`user.email`
config value |
| git_main_branch | Returns the name of the main branch:
`ma
in`
if it exists,
`master
`
otherwise |
| git_main_branch | Returns the name of the main branch:
`ma
ster`
if it exists,
`main
`
otherwise |
### Work in Progress (WIP)
...
...
plugins/git/git.plugin.zsh
View file @
1db79f97
...
...
@@ -27,10 +27,10 @@ function work_in_progress() {
# Check if main exists and use instead of master
function
git_main_branch
()
{
if
[[
-n
"
$(
git branch
--list
main
)
"
]]
;
then
echo
main
else
if
[[
-n
"
$(
git branch
--list
master
)
"
]]
;
then
echo
master
else
echo
main
fi
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment