Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
ab585941
Unverified
Commit
ab585941
authored
Aug 10, 2021
by
Max Eisner
Committed by
GitHub
Aug 10, 2021
Browse files
feat(git): add `develop` branch name detection (#9881)
parent
9c34c359
Changes
2
Show whitespace changes
Inline
Side-by-side
plugins/git/README.md
View file @
ab585941
...
...
@@ -23,7 +23,7 @@ plugins=(... git)
| gb | git branch |
| gba | git branch -a |
| gbd | git branch -d |
| gbda | git branch --no-color --merged
\|
command grep -vE "^(
\+\|\*\|\s
*($(git_main_branch)\|develop
ment\|develop\|devel\|dev
)\s*
$)"
\|
command xargs -n 1 git branch -d |
| gbda | git branch --no-color --merged
\|
command grep -vE "^(
\+\|\*\|\s
*($(git_main_branch)\|
$(git_
develop
_branch)
)\s*
$)"
\|
command xargs -n 1 git branch -d |
| gbD | git branch -D |
| gbl | git blame -b -w |
| gbnm | git branch --no-merged |
...
...
@@ -50,7 +50,7 @@ plugins=(... git)
| gclean | git clean -id |
| gpristine | git reset --hard && git clean -dffx |
| gcm | git checkout $(git_main_branch) |
| gcd | git checkout develop
|
| gcd | git checkout
$(git_
develop
_branch)
|
| gcmsg | git commit -m |
| gco | git checkout |
| gcor | git checkout --recurse-submodules |
...
...
@@ -125,7 +125,7 @@ plugins=(... git)
| grb | git rebase |
| grba | git rebase --abort |
| grbc | git rebase --continue |
| grbd | git rebase develop
|
| grbd | git rebase
$(git_
develop
_branch)
|
| grbi | git rebase -i |
| grbm | git rebase $(git_main_branch) |
| grbo | git rebase --onto |
...
...
@@ -215,12 +215,13 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
### Current
| Command | Description |
|:-----------------------|:-----------------------------------------------------------------------------|
|:-----------------------|:-----------------------------------------------------------------------------
----------------------------
|
|
`grename <old> <new>`
| Rename
`old`
branch to
`new`
, including in origin remote |
| 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:
`main`
if it exists,
`master`
otherwise |
| git_develop_branch | Returns the name of the develop branch:
`dev`
,
`devel`
,
`development`
if they exist,
`develop`
otherwise |
### Work in Progress (WIP)
...
...
plugins/git/git.plugin.zsh
View file @
ab585941
...
...
@@ -42,6 +42,19 @@ function git_main_branch() {
echo
master
}
# Check for develop and similarly named branches
function
git_develop_branch
()
{
command
git rev-parse
--git-dir
&>/dev/null
||
return
local
branch
for
branch
in
dev devel development
;
do
if
command
git show-ref
-q
--verify
refs/heads/
$branch
;
then
echo
$branch
return
fi
done
echo
develop
}
#
# Aliases
# (sorted alphabetically)
...
...
@@ -60,7 +73,7 @@ alias gapt='git apply --3way'
alias
gb
=
'git branch'
alias
gba
=
'git branch -a'
alias
gbd
=
'git branch -d'
alias
gbda
=
'git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|
development|develop|devel|dev
)\s*$)" | command xargs -n 1 git branch -d'
alias
gbda
=
'git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|
$(git_develop_branch)
)\s*$)" | command xargs -n 1 git branch -d'
alias
gbD
=
'git branch -D'
alias
gbl
=
'git blame -b -w'
alias
gbnm
=
'git branch --no-merged'
...
...
@@ -88,7 +101,7 @@ alias gcl='git clone --recurse-submodules'
alias
gclean
=
'git clean -id'
alias
gpristine
=
'git reset --hard && git clean -dffx'
alias
gcm
=
'git checkout $(git_main_branch)'
alias
gcd
=
'git checkout develop'
alias
gcd
=
'git checkout
$(git_
develop
_branch)
'
alias
gcmsg
=
'git commit -m'
alias
gco
=
'git checkout'
alias
gcor
=
'git checkout --recurse-submodules'
...
...
@@ -227,7 +240,7 @@ alias gra='git remote add'
alias
grb
=
'git rebase'
alias
grba
=
'git rebase --abort'
alias
grbc
=
'git rebase --continue'
alias
grbd
=
'git rebase develop'
alias
grbd
=
'git rebase
$(git_
develop
_branch)
'
alias
grbi
=
'git rebase -i'
alias
grbm
=
'git rebase $(git_main_branch)'
alias
grbo
=
'git rebase --onto'
...
...
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