mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 10:22:00 +00:00
feat(git): add develop
branch name detection (#9881)
This commit is contained in:
parent
9c34c359c4
commit
ab58594173
2 changed files with 34 additions and 20 deletions
|
@ -23,7 +23,7 @@ plugins=(... git)
|
||||||
| gb | git branch |
|
| gb | git branch |
|
||||||
| gba | git branch -a |
|
| gba | git branch -a |
|
||||||
| gbd | git branch -d |
|
| gbd | git branch -d |
|
||||||
| 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 |
|
| 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 |
|
| gbD | git branch -D |
|
||||||
| gbl | git blame -b -w |
|
| gbl | git blame -b -w |
|
||||||
| gbnm | git branch --no-merged |
|
| gbnm | git branch --no-merged |
|
||||||
|
@ -49,8 +49,8 @@ plugins=(... git)
|
||||||
| gcl | git clone --recurse-submodules |
|
| gcl | git clone --recurse-submodules |
|
||||||
| gclean | git clean -id |
|
| gclean | git clean -id |
|
||||||
| gpristine | git reset --hard && git clean -dffx |
|
| gpristine | git reset --hard && git clean -dffx |
|
||||||
| gcm | git checkout $(git_main_branch) |
|
| gcm | git checkout $(git_main_branch) |
|
||||||
| gcd | git checkout develop |
|
| gcd | git checkout $(git_develop_branch) |
|
||||||
| gcmsg | git commit -m |
|
| gcmsg | git commit -m |
|
||||||
| gco | git checkout |
|
| gco | git checkout |
|
||||||
| gcor | git checkout --recurse-submodules |
|
| gcor | git checkout --recurse-submodules |
|
||||||
|
@ -88,7 +88,7 @@ plugins=(... git)
|
||||||
| ghh | git help |
|
| ghh | git help |
|
||||||
| gignore | git update-index --assume-unchanged |
|
| gignore | git update-index --assume-unchanged |
|
||||||
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
||||||
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
|
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
|
||||||
| gk | gitk --all --branches |
|
| gk | gitk --all --branches |
|
||||||
| gke | gitk --all $(git log -g --pretty=%h) |
|
| gke | gitk --all $(git log -g --pretty=%h) |
|
||||||
| gl | git pull |
|
| gl | git pull |
|
||||||
|
@ -107,10 +107,10 @@ plugins=(... git)
|
||||||
| gloga | git log --oneline --decorate --graph --all |
|
| gloga | git log --oneline --decorate --graph --all |
|
||||||
| glp | git log --pretty=\<format\> |
|
| glp | git log --pretty=\<format\> |
|
||||||
| gm | git merge |
|
| gm | git merge |
|
||||||
| gmom | git merge origin/$(git_main_branch) |
|
| gmom | git merge origin/$(git_main_branch) |
|
||||||
| gmt | git mergetool --no-prompt |
|
| gmt | git mergetool --no-prompt |
|
||||||
| gmtvim | git mergetool --no-prompt --tool=vimdiff |
|
| gmtvim | git mergetool --no-prompt --tool=vimdiff |
|
||||||
| gmum | git merge upstream/$(git_main_branch) |
|
| gmum | git merge upstream/$(git_main_branch) |
|
||||||
| gma | git merge --abort |
|
| gma | git merge --abort |
|
||||||
| gp | git push |
|
| gp | git push |
|
||||||
| gpd | git push --dry-run |
|
| gpd | git push --dry-run |
|
||||||
|
@ -125,10 +125,10 @@ plugins=(... git)
|
||||||
| grb | git rebase |
|
| grb | git rebase |
|
||||||
| grba | git rebase --abort |
|
| grba | git rebase --abort |
|
||||||
| grbc | git rebase --continue |
|
| grbc | git rebase --continue |
|
||||||
| grbd | git rebase develop |
|
| grbd | git rebase $(git_develop_branch) |
|
||||||
| grbi | git rebase -i |
|
| grbi | git rebase -i |
|
||||||
| grbm | git rebase $(git_main_branch) |
|
| grbm | git rebase $(git_main_branch) |
|
||||||
| grbo | git rebase --onto |
|
| grbo | git rebase --onto |
|
||||||
| grbs | git rebase --skip |
|
| grbs | git rebase --skip |
|
||||||
| grev | git revert |
|
| grev | git revert |
|
||||||
| grh | git reset |
|
| grh | git reset |
|
||||||
|
@ -176,7 +176,7 @@ plugins=(... git)
|
||||||
| gupv | git pull --rebase -v |
|
| gupv | git pull --rebase -v |
|
||||||
| gupa | git pull --rebase --autostash |
|
| gupa | git pull --rebase --autostash |
|
||||||
| gupav | git pull --rebase --autostash -v |
|
| gupav | git pull --rebase --autostash -v |
|
||||||
| glum | git pull upstream $(git_main_branch) |
|
| glum | git pull upstream $(git_main_branch) |
|
||||||
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
||||||
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
|
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
|
||||||
| gam | git am |
|
| gam | git am |
|
||||||
|
@ -214,13 +214,14 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
|
||||||
|
|
||||||
### Current
|
### Current
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|:-----------------------|:-----------------------------------------------------------------------------|
|
|:-----------------------|:---------------------------------------------------------------------------------------------------------|
|
||||||
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
|
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
|
||||||
| 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: `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)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,19 @@ function git_main_branch() {
|
||||||
echo master
|
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
|
# Aliases
|
||||||
# (sorted alphabetically)
|
# (sorted alphabetically)
|
||||||
|
@ -60,7 +73,7 @@ alias gapt='git apply --3way'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
alias gbd='git branch -d'
|
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 gbD='git branch -D'
|
||||||
alias gbl='git blame -b -w'
|
alias gbl='git blame -b -w'
|
||||||
alias gbnm='git branch --no-merged'
|
alias gbnm='git branch --no-merged'
|
||||||
|
@ -88,7 +101,7 @@ alias gcl='git clone --recurse-submodules'
|
||||||
alias gclean='git clean -id'
|
alias gclean='git clean -id'
|
||||||
alias gpristine='git reset --hard && git clean -dffx'
|
alias gpristine='git reset --hard && git clean -dffx'
|
||||||
alias gcm='git checkout $(git_main_branch)'
|
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 gcmsg='git commit -m'
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
alias gcor='git checkout --recurse-submodules'
|
alias gcor='git checkout --recurse-submodules'
|
||||||
|
@ -227,7 +240,7 @@ alias gra='git remote add'
|
||||||
alias grb='git rebase'
|
alias grb='git rebase'
|
||||||
alias grba='git rebase --abort'
|
alias grba='git rebase --abort'
|
||||||
alias grbc='git rebase --continue'
|
alias grbc='git rebase --continue'
|
||||||
alias grbd='git rebase develop'
|
alias grbd='git rebase $(git_develop_branch)'
|
||||||
alias grbi='git rebase -i'
|
alias grbi='git rebase -i'
|
||||||
alias grbm='git rebase $(git_main_branch)'
|
alias grbm='git rebase $(git_main_branch)'
|
||||||
alias grbo='git rebase --onto'
|
alias grbo='git rebase --onto'
|
||||||
|
|
Loading…
Reference in a new issue