mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-18 02:20:09 +00:00
fix(git)!: standardize git pull --rebase
aliases (#11224)
BREAKING CHANGE: The alias `gup` for `git pull --rebase` and its derivatives are replaced by `gpr` for standardization. This means the previous aliases will no longer be available after a few months. Meanwhile, the original aliases are still working, with a deprecation notice. See https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/README.md#deprecated-aliases for the full list of deprecated aliases. Fixes #11104 Closes #11224 Co-authored-by: Marc Cornellà <marc@mcornella.com>
This commit is contained in:
parent
9f84ba0854
commit
207d29b716
2 changed files with 242 additions and 221 deletions
|
@ -11,7 +11,7 @@ plugins=(... git)
|
|||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
|
||||
| `ggpnp` | `ggl && ggp` |
|
||||
| `ggpur` | `ggu` |
|
||||
|
@ -116,13 +116,11 @@ plugins=(... git)
|
|||
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
|
||||
| `gl` | `git pull` |
|
||||
| `gpr` | `git pull --rebase` |
|
||||
| `gup` | `git pull --rebase` |
|
||||
| `gupa` | `git pull --rebase --autostash` |
|
||||
| `gupav` | `git pull --rebase --autostash --verbose` |
|
||||
| `gupv` | `git pull --rebase --verbose` |
|
||||
| `ggu` | `git pull --rebase origin $(current_branch)` |
|
||||
| `gupom` | `git pull --rebase origin $(git_main_branch)` |
|
||||
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` |
|
||||
| `gprv` | `git pull --rebase -v` |
|
||||
| `gpra` | `git pull --rebase --autostash` |
|
||||
| `gprav` | `git pull --rebase --autostash -v` |
|
||||
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
|
||||
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
|
||||
| `ggpull` | `git pull origin "$(git_current_branch)"` |
|
||||
| `ggl` | `git pull origin $(current_branch)` |
|
||||
| `gluc` | `git pull upstream $(git_current_branch)` |
|
||||
|
@ -225,7 +223,7 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
|
|||
receive further support.
|
||||
|
||||
| Alias | Command | Modification |
|
||||
| :------- | :----------------------------------------------------- | :-------------------------------------------------------- |
|
||||
| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
|
||||
| `gap` | `git add --patch` | New alias: `gapa`. |
|
||||
| `gcl` | `git config --list` | New alias: `gcf`. |
|
||||
| `gdc` | `git diff --cached` | New alias: `gdca`. |
|
||||
|
@ -237,6 +235,12 @@ receive further support.
|
|||
| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
|
||||
| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
|
||||
| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
|
||||
| `gup` | `git pull --rebase` | now alias `gpr` |
|
||||
| `gupv` | `git pull --rebase -v` | now alias `gprv` |
|
||||
| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
|
||||
| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
|
||||
| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
|
||||
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
|
||||
|
||||
## Functions
|
||||
|
||||
|
|
|
@ -246,12 +246,12 @@ alias gmom='git merge origin/$(git_main_branch)'
|
|||
alias gmum='git merge upstream/$(git_main_branch)'
|
||||
alias gmtl='git mergetool --no-prompt'
|
||||
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
||||
|
||||
alias gl='git pull'
|
||||
alias gpr='git pull --rebase'
|
||||
alias gup='git pull --rebase'
|
||||
alias gupa='git pull --rebase --autostash'
|
||||
alias gupav='git pull --rebase --autostash --verbose'
|
||||
alias gupv='git pull --rebase --verbose'
|
||||
alias gprv='git pull --rebase -v'
|
||||
alias gpra='git pull --rebase --autostash'
|
||||
alias gprav='git pull --rebase --autostash -v'
|
||||
|
||||
function ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
|
@ -259,8 +259,8 @@ function ggu() {
|
|||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
||||
alias gupom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||
|
||||
function ggl() {
|
||||
|
@ -388,3 +388,20 @@ alias gk='\gitk --all --branches &!'
|
|||
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||
|
||||
unset git_version
|
||||
|
||||
# Logic for adding warnings on deprecated aliases
|
||||
local old_alias new_alias
|
||||
for old_alias new_alias (
|
||||
# TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
|
||||
gup gpr
|
||||
gupv gprv
|
||||
gupa gpra
|
||||
gupav gprav
|
||||
gupom gprom
|
||||
gupomi gpromi
|
||||
); do
|
||||
aliases[$old_alias]="
|
||||
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
|
||||
$new_alias"
|
||||
done
|
||||
unset old_alias new_alias
|
||||
|
|
Loading…
Reference in a new issue