1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 10:22:00 +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:
Zeeshan 2022-10-04 18:51:24 +05:30 committed by Marc Cornellà
parent 9f84ba0854
commit 207d29b716
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
2 changed files with 242 additions and 221 deletions

View file

@ -11,7 +11,7 @@ plugins=(... git)
## Aliases ## Aliases
| Alias | Command | | Alias | Command |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` | | `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
| `ggpnp` | `ggl && ggp` | | `ggpnp` | `ggl && ggp` |
| `ggpur` | `ggu` | | `ggpur` | `ggu` |
@ -116,13 +116,11 @@ plugins=(... git)
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` | | `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
| `gl` | `git pull` | | `gl` | `git pull` |
| `gpr` | `git pull --rebase` | | `gpr` | `git pull --rebase` |
| `gup` | `git pull --rebase` | | `gprv` | `git pull --rebase -v` |
| `gupa` | `git pull --rebase --autostash` | | `gpra` | `git pull --rebase --autostash` |
| `gupav` | `git pull --rebase --autostash --verbose` | | `gprav` | `git pull --rebase --autostash -v` |
| `gupv` | `git pull --rebase --verbose` | | `gprom` | `git pull --rebase origin $(git_main_branch)` |
| `ggu` | `git pull --rebase origin $(current_branch)` | | `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
| `gupom` | `git pull --rebase origin $(git_main_branch)` |
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` |
| `ggpull` | `git pull origin "$(git_current_branch)"` | | `ggpull` | `git pull origin "$(git_current_branch)"` |
| `ggl` | `git pull origin $(current_branch)` | | `ggl` | `git pull origin $(current_branch)` |
| `gluc` | `git pull upstream $(git_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. receive further support.
| Alias | Command | Modification | | Alias | Command | Modification |
| :------- | :----------------------------------------------------- | :-------------------------------------------------------- | | :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
| `gap` | `git add --patch` | New alias: `gapa`. | | `gap` | `git add --patch` | New alias: `gapa`. |
| `gcl` | `git config --list` | New alias: `gcf`. | | `gcl` | `git config --list` | New alias: `gcf`. |
| `gdc` | `git diff --cached` | New alias: `gdca`. | | `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`. | | `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`. | | `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`. | | `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 ## Functions

View file

@ -246,12 +246,12 @@ alias gmom='git merge origin/$(git_main_branch)'
alias gmum='git merge upstream/$(git_main_branch)' alias gmum='git merge upstream/$(git_main_branch)'
alias gmtl='git mergetool --no-prompt' alias gmtl='git mergetool --no-prompt'
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
alias gl='git pull' alias gl='git pull'
alias gpr='git pull --rebase' alias gpr='git pull --rebase'
alias gup='git pull --rebase' alias gprv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash' alias gpra='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash --verbose' alias gprav='git pull --rebase --autostash -v'
alias gupv='git pull --rebase --verbose'
function ggu() { function ggu() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)" [[ "$#" != 1 ]] && local b="$(git_current_branch)"
@ -259,8 +259,8 @@ function ggu() {
} }
compdef _git ggu=git-checkout compdef _git ggu=git-checkout
alias gupom='git pull --rebase origin $(git_main_branch)' alias gprom='git pull --rebase origin $(git_main_branch)'
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)' alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
alias ggpull='git pull origin "$(git_current_branch)"' alias ggpull='git pull origin "$(git_current_branch)"'
function ggl() { function ggl() {
@ -388,3 +388,20 @@ alias gk='\gitk --all --branches &!'
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!' alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
unset git_version 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