From c177f9dcdf1842782ecaa8a5e7e1719d68c171a5 Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 00:50:48 +0800 Subject: [PATCH 1/5] refactor(git)!: Remove deprecated `git pull --rebase` aliases --- plugins/git/README.md | 6 ------ plugins/git/git.plugin.zsh | 7 ------- 2 files changed, 13 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 0ecbea7b6..da3f903f0 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -247,12 +247,6 @@ 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 diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c11799208..63b633af5 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -430,13 +430,6 @@ 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\" From 118ffe6fc1138c724cbdab629c5f85b6e203a22b Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 02:18:46 +0800 Subject: [PATCH 2/5] refactor(git)!: Start deprecating `ggpull`/`ggpur`/`ggpush` for their alternative functions --- plugins/git/README.md | 6 +++--- plugins/git/git.plugin.zsh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index da3f903f0..050717e82 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -240,13 +240,13 @@ receive further support. | `gcl` | `git config --list` | New alias: `gcf`. | | `gdc` | `git diff --cached` | New alias: `gdca`. | | `gdt` | `git difftool` | No replacement. | -| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) | -| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) | -| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) | | `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. | | `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`. | +| `ggpull` | `git pull origin $(git_current_branch)` | New function: `ggl` (`ggpull` is now aliased to this) | +| `ggpur` | `git pull --rebase origin $(git_current_branch)` | New function: `ggu` (`ggpur` is now aliased to this) | +| `ggpush` | `git push origin $(git_current_branch)` | New function: `ggp` (`ggpush` is now aliased to this) | ## Functions diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 63b633af5..271018837 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -110,7 +110,6 @@ function ggpnp() { } compdef _git ggpnp=git-checkout -alias ggpur='ggu' alias g='git' alias ga='git add' alias gaa='git add --all' @@ -290,7 +289,6 @@ alias gprom='git pull --rebase origin $(git_main_branch)' alias gpromi='git pull --rebase=interactive origin $(git_main_branch)' alias gprum='git pull --rebase upstream $(git_main_branch)' alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)' -alias ggpull='git pull origin "$(git_current_branch)"' function ggl() { if [[ $# != 0 ]] && [[ $# != 1 ]]; then @@ -334,7 +332,6 @@ is-at-least 2.30 "$git_version" \ alias gpv='git push --verbose' alias gpoat='git push origin --all && git push origin --tags' alias gpod='git push origin --delete' -alias ggpush='git push origin "$(git_current_branch)"' function ggp() { if [[ $# != 0 ]] && [[ $# != 1 ]]; then @@ -430,6 +427,9 @@ unset git_version # Logic for adding warnings on deprecated aliases local old_alias new_alias for old_alias new_alias ( + ggpull ggl + ggpur ggu + ggpush ggp ); 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\" From bc45503bf8b01569d5e24f32f41a3a467047d5a9 Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 02:25:19 +0800 Subject: [PATCH 3/5] refactor(git)!: Start deprecating `current_branch` function --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 050717e82..ed6fc2feb 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -254,7 +254,6 @@ receive further support. | Command | Description | | :----------------------- | :-------------------------------------------------------------------------------------------------------------- | -| `current_branch` | Returns the name of the current branch. | | `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) | | `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) | | `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. | @@ -262,6 +261,7 @@ receive further support. | `grename ` | Renames branch `` to ``, including on the origin remote. | | `gbda` | Deletes all merged branches | | `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | +| `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 271018837..a240e1fb3 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -8,14 +8,6 @@ git_version="${${(As: :)$(git version 2>/dev/null)}[3]}" # (order should follow README) # -# The name of the current branch -# Back-compatibility wrapper for when this function was defined here in -# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() -# to fix the core -> git plugin dependency. -function current_branch() { - git_current_branch -} - # Check for develop and similarly named branches function git_develop_branch() { command git rev-parse --git-dir &>/dev/null || return @@ -424,15 +416,16 @@ 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 ( +# Logic for adding warnings on deprecated aliases or functions +local old_name new_name +for old_name new_name ( + current_branch git_current_branch ggpull ggl ggpur ggu ggpush ggp ); 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" + aliases[$old_name]=" + print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_name}%F{yellow}' is deprecated, using '%F{green}${new_name}%F{yellow}' instead.%f\" + $new_name" done -unset old_alias new_alias +unset old_name new_name From 2f683d7a6e9500bf00dd2bed9b238eee028f3e05 Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 02:33:54 +0800 Subject: [PATCH 4/5] docs(git): Clean up alias and function tables --- plugins/git/README.md | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index ed6fc2feb..58a0065e3 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -234,34 +234,31 @@ branch exists. We do this via the function `git_main_branch`. These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, 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`. | -| `gdt` | `git difftool` | No replacement. | -| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. | -| `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`. | +| Alias | Command | Modification | +| :------- | :-------------------------------------------------------- | :-----------------------------------------------------| +| `gap` | `git add --patch` | New alias: `gapa` | +| `gcl` | `git config --list` | New alias: `gcf` | +| `gdc` | `git diff --cached` | New alias: `gdca` | +| `gdt` | `git difftool` | No replacement | | `ggpull` | `git pull origin $(git_current_branch)` | New function: `ggl` (`ggpull` is now aliased to this) | | `ggpur` | `git pull --rebase origin $(git_current_branch)` | New function: `ggu` (`ggpur` is now aliased to this) | | `ggpush` | `git push origin $(git_current_branch)` | New function: `ggp` (`ggpush` is now aliased to this) | +| `gwc` | `git whatchanged -p --abbrev-commit --pretty=medium` | New alias: `gwch` | ## Functions ### Current -| Command | Description | -| :----------------------- | :-------------------------------------------------------------------------------------------------------------- | -| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) | -| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) | -| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. | -| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. | -| `grename ` | Renames branch `` to ``, including on the origin remote. | -| `gbda` | Deletes all merged branches | -| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | +| Command | Description | +| :----------------------- | :------------------------------------------------------------------------------------------------------------- | | `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) | +| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) | +| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) | +| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise | +| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| `grename ` | Renames branch `` to ``, including on the origin remote | +| `gbda` | Deletes all merged branches | +| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | ### Work in Progress (WIP) @@ -281,4 +278,3 @@ Note that `gwip` and `gunwip` are aliases, but are also documented here to group | Command | Description | Reason | | :------------------- | :-------------------------------------- | :--------------------------------------------------------------- | -| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). | From f2b4d443af21acbe6a1219fe29c96e8b438a8e87 Mon Sep 17 00:00:00 2001 From: Arvin Verain Date: Mon, 2 Jun 2025 02:58:50 +0800 Subject: [PATCH 5/5] docs(git): Unlist long-removed aliases There are some aliases, whose functionality has long been reassigned to different aliases, but have not been reused for new commands, yet are still documented in the README. Remove them. --- plugins/git/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 58a0065e3..bbbb28bdf 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -238,12 +238,10 @@ receive further support. | :------- | :-------------------------------------------------------- | :-----------------------------------------------------| | `gap` | `git add --patch` | New alias: `gapa` | | `gcl` | `git config --list` | New alias: `gcf` | -| `gdc` | `git diff --cached` | New alias: `gdca` | | `gdt` | `git difftool` | No replacement | | `ggpull` | `git pull origin $(git_current_branch)` | New function: `ggl` (`ggpull` is now aliased to this) | | `ggpur` | `git pull --rebase origin $(git_current_branch)` | New function: `ggu` (`ggpur` is now aliased to this) | | `ggpush` | `git push origin $(git_current_branch)` | New function: `ggp` (`ggpush` is now aliased to this) | -| `gwc` | `git whatchanged -p --abbrev-commit --pretty=medium` | New alias: `gwch` | ## Functions