Message
refactor(git)!: remove old deprecated aliases (#13149)
BREAKING CHANGE: the following deprecated aliases have been removed:
gup, gupv, gupa, gupav, gupom, gupom. The following aliases have been
deprecated: ggpull, ggpur, ggpush. `current_branch` has also been
deprecated, in favor of `git_current_branch`.
Diff
1diff --git a/plugins/git/README.md b/plugins/git/README.md
2index 0ecbea7b65e44f670709fae278b5a51f10f7cbdc..bbbb28bdfd490c4b7c7d17981d3aaf4e585a0c31 100644
3--- a/plugins/git/README.md
4+++ b/plugins/git/README.md
5@@ -234,40 +234,29 @@ branch exists. We do this via the function `git_main_branch`.
6 These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not,
7 receive further support.
8
9-| Alias | Command | Modification |
10-| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
11-| `gap` | `git add --patch` | New alias: `gapa`. |
12-| `gcl` | `git config --list` | New alias: `gcf`. |
13-| `gdc` | `git diff --cached` | New alias: `gdca`. |
14-| `gdt` | `git difftool` | No replacement. |
15-| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) |
16-| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) |
17-| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) |
18-| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. |
19-| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
20-| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
21-| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
22-| `gup` | `git pull --rebase` | now alias `gpr` |
23-| `gupv` | `git pull --rebase -v` | now alias `gprv` |
24-| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
25-| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
26-| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
27-| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
28+| Alias | Command | Modification |
29+| :------- | :-------------------------------------------------------- | :-----------------------------------------------------|
30+| `gap` | `git add --patch` | New alias: `gapa` |
31+| `gcl` | `git config --list` | New alias: `gcf` |
32+| `gdt` | `git difftool` | No replacement |
33+| `ggpull` | `git pull origin $(git_current_branch)` | New function: `ggl` (`ggpull` is now aliased to this) |
34+| `ggpur` | `git pull --rebase origin $(git_current_branch)` | New function: `ggu` (`ggpur` is now aliased to this) |
35+| `ggpush` | `git push origin $(git_current_branch)` | New function: `ggp` (`ggpush` is now aliased to this) |
36
37 ## Functions
38
39 ### Current
40
41-| Command | Description |
42-| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
43-| `current_branch` | Returns the name of the current branch. |
44-| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
45-| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
46-| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
47-| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
48-| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
49-| `gbda` | Deletes all merged branches |
50-| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
51+| Command | Description |
52+| :----------------------- | :------------------------------------------------------------------------------------------------------------- |
53+| `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) |
54+| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) |
55+| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
56+| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
57+| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
58+| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
59+| `gbda` | Deletes all merged branches |
60+| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
61
62 ### Work in Progress (WIP)
63
64@@ -287,4 +276,3 @@ Note that `gwip` and `gunwip` are aliases, but are also documented here to group
65
66 | Command | Description | Reason |
67 | :------------------- | :-------------------------------------- | :--------------------------------------------------------------- |
68-| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). |
69diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
70index c11799208ec0772ccbbccdfd51139ed18077d5fa..a240e1fb3101510f9c4d5f789cacf30d03ca2e06 100644
71--- a/plugins/git/git.plugin.zsh
72+++ b/plugins/git/git.plugin.zsh
73@@ -8,14 +8,6 @@ git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
74 # (order should follow README)
75 #
76
77-# The name of the current branch
78-# Back-compatibility wrapper for when this function was defined here in
79-# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
80-# to fix the core -> git plugin dependency.
81-function current_branch() {
82- git_current_branch
83-}
84-
85 # Check for develop and similarly named branches
86 function git_develop_branch() {
87 command git rev-parse --git-dir &>/dev/null || return
88@@ -110,7 +102,6 @@ function ggpnp() {
89 }
90 compdef _git ggpnp=git-checkout
91
92-alias ggpur='ggu'
93 alias g='git'
94 alias ga='git add'
95 alias gaa='git add --all'
96@@ -290,7 +281,6 @@ alias gprom='git pull --rebase origin $(git_main_branch)'
97 alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
98 alias gprum='git pull --rebase upstream $(git_main_branch)'
99 alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)'
100-alias ggpull='git pull origin "$(git_current_branch)"'
101
102 function ggl() {
103 if [[ $# != 0 ]] && [[ $# != 1 ]]; then
104@@ -334,7 +324,6 @@ is-at-least 2.30 "$git_version" \
105 alias gpv='git push --verbose'
106 alias gpoat='git push origin --all && git push origin --tags'
107 alias gpod='git push origin --delete'
108-alias ggpush='git push origin "$(git_current_branch)"'
109
110 function ggp() {
111 if [[ $# != 0 ]] && [[ $# != 1 ]]; then
112@@ -427,19 +416,16 @@ alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
113
114 unset git_version
115
116-# Logic for adding warnings on deprecated aliases
117-local old_alias new_alias
118-for old_alias new_alias (
119- # TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
120- gup gpr
121- gupv gprv
122- gupa gpra
123- gupav gprav
124- gupom gprom
125- gupomi gpromi
126+# Logic for adding warnings on deprecated aliases or functions
127+local old_name new_name
128+for old_name new_name (
129+ current_branch git_current_branch
130+ ggpull ggl
131+ ggpur ggu
132+ ggpush ggp
133 ); do
134- aliases[$old_alias]="
135- 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\"
136- $new_alias"
137+ aliases[$old_name]="
138+ print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_name}%F{yellow}' is deprecated, using '%F{green}${new_name}%F{yellow}' instead.%f\"
139+ $new_name"
140 done
141-unset old_alias new_alias
142+unset old_name new_name