Skip to content

Commit 023afa2

Browse files
committed
feat(fish): expand git abbreviations with advanced workflows
Enhanced the Fish shell git abbreviation system to support more comprehensive Git workflows. Reorganized abbreviation structure for better logical grouping and added detailed documentation in README. - Reorganized git abbreviations into logical groups: staging, branching, committing, remote ops, merging, rebasing, resetting, stashing, tagging, and logging - Added new abbreviations for merge operations: `gm` (git merge), `gms` (git merge --squash) - Added new abbreviations for rebase workflows: `grb` (git rebase), `grbc` (git rebase --continue), `grbi` (git rebase -i) - Enhanced reset/restore commands: `gr` (git reset), `grh` (git reset HEAD), `gro` (git restore), `gros` (git restore --staged) - Added tagging support: `gt` (git tag), `gts` (git tag -s) - Improved logging abbreviations: `gl` now shows decorated graph, added `glo` (oneline), `gls` (stat) - Updated README.md with three-column table showing abbreviation, command, and description - Changed `gl` from `git pull` to `git log --oneline --decorate --graph`, added `gpl` for pull operations - Added `gcm` for quick commit with message
1 parent 87982b8 commit 023afa2

2 files changed

Lines changed: 46 additions & 25 deletions

File tree

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -517,23 +517,31 @@ echo "*.log" >> ~/.config/git/ignore
517517

518518
缩写在输入后按空格时**自动展开**为完整命令。
519519

520-
| 缩写 | 展开为 |
521-
|------|--------|
522-
| `mkdir` | `mkdir -p` |
523-
| `ls` | `eza` |
524-
| `ll` | `eza -l` |
525-
| `...` | `../..` (以此类推 `....`, `.....`) |
526-
| `vi` / `vim` / `h` | `hx` |
527-
| `cs` / `fs` / `o` / `vol` | `colorscheme` / `font-size` / `opacity` / `audio-volume` |
528-
| `g` | `git` |
529-
| `gb` / `gba` / `gbd` | `git branch` / `git branch -a` / `git branch -D` |
530-
| `ga` / `gs` / `gd` / `gds` | `git add` / `git status` / `git diff` / `git diff --staged` |
531-
| `gc` / `gca` / `gcam` | `git commit` / `git commit --amend` / `git commit -a -m` |
532-
| `gsta` / `gstp` | `git stash` / `git stash pop` |
533-
| `gp` / `gl` / `gco` | `git push` / `git pull` / `git checkout` |
534-
| `gsw` / `gswc` | `git switch` / `git switch -c` |
535-
| `gr` / `grs` | `git restore` / `git restore --staged` |
536-
| `gg` | `git log` |
520+
| 缩写 | 展开为 | 实际含义 |
521+
|------|--------|----------|
522+
| `mkdir` | `mkdir -p` | 级联创建多级目录 (如果父目录不存在自动创建) |
523+
| `ls` / `ll` | `eza` / `eza -l` | 现代版的文件列表显示 / 附带详细权限尺寸等信息 |
524+
| `...` / `....` | `../..` / `../../..` | 极速向下上级两层、三层目录跳转 |
525+
| `vi` / `vim` / `h` | `hx` | 统一唤起 Helix 现代文本编辑器 |
526+
| `cs`... | `colorscheme`... | 详情见自定义命令 `colorscheme`/`font-size`/`opacity`/`audio-volume` |
527+
| `g` | `git` | Git 基础命令调用入口 |
528+
| `ga` / `gs` | `git add` / `git status` | 添加文件到暂存区 / 查看工作区及合并状态 |
529+
| `gd` / `gds` | `git diff` / `git diff --staged` | 查看工作区尚未暂存的修改 / 查看暂存区里尚未提交的差异 |
530+
| `gb` / `gba` / `gbd` | `git branch`... | 查看本地分支 / 查看全部(含远程)分支 / 强制删除分支 |
531+
| `gc` / `gca` | `git commit` / `git commit --amend` | 提交代码 / 追加或修改最后一次提交 |
532+
| `gcm` / `gcam` | `git commit -m` / `git commit -a -m` | 带信息提交代码 / 暂存所有已跟踪文件并提交代码 |
533+
| `gp` / `gpl` | `git push` / `git pull` | 推送代码到远程仓库 / 拉取远程代码 |
534+
| `gm` / `gms` | `git merge` / `git merge --squash` | 合并分支 / 将整条开发分支的多次提交合并压缩为一次改动 |
535+
| `grb` / `grbc` / `grbi` | `git rebase`... | 变基分支 / 解决冲突后继续跑变基 / 交互式手工挑选、压缩变基 |
536+
| `gco` | `git checkout` | 检出分支或文件 (传统方式) |
537+
| `gsw` / `gswc` | `git switch` / `git switch -c` | 切换分支 / 创建并切换分支 (推荐的现代分支方式) |
538+
| `gr` / `grh` | `git reset` / `git reset HEAD` | 重置暂存区或 HEAD 状态 / 仅重置暂存区 (撤销 add) |
539+
| `gro` / `gros` | `git restore`... | 撤销工作区修改 / 撤销暂存区修改 (推荐的现代重置方式) |
540+
| `gsta` / `gstp` | `git stash` / `git stash pop` | 雪藏当前未提交改动清空工作区 / 弹出并恢复雪藏内容 |
541+
| `gt` / `gts` | `git tag` / `git tag -s` | 查看本地所有标签 / 创建带本地 GPG 签名的标签 |
542+
| `gg` | `git log` | 查看原始 Git 提交日志 |
543+
| `gl` | `git log --oneline --decorate --graph` | 【高频】带分支图谱路径、彩色树状结构的美化历史日志 |
544+
| `glo` / `gls` | `git log --oneline` / `git log --stat` | 单行极简日志 / 附带每次提交具体增删文件统计信息的日志 |
537545

538546
**Vi 模式**
539547
Fish 支持 Vi 风格编辑模式,本配置已默认启用。

fish/dot-config/fish/config.fish

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,38 @@ if status is-interactive
137137
# Git 缩写
138138
abbr -a -g g git
139139
abbr -a -g ga 'git add'
140-
abbr -a -g gb 'git branch'
141-
abbr -a -g gba 'git branch -a'
142140
abbr -a -g gs 'git status'
143141
abbr -a -g gd 'git diff'
144142
abbr -a -g gds 'git diff --staged'
143+
abbr -a -g gb 'git branch'
144+
abbr -a -g gba 'git branch -a'
145+
abbr -a -g gbd 'git branch -D'
145146
abbr -a -g gc 'git commit'
146147
abbr -a -g gca 'git commit --amend'
148+
abbr -a -g gcm 'git commit -m'
147149
abbr -a -g gcam 'git commit -a -m'
148-
abbr -a -g gsta 'git stash'
149-
abbr -a -g gstp 'git stash pop'
150-
abbr -a -g gbd 'git branch -D'
151150
abbr -a -g gp 'git push'
152-
abbr -a -g gl 'git pull'
151+
abbr -a -g gpl 'git pull'
152+
abbr -a -g gm 'git merge'
153+
abbr -a -g gms 'git merge --squash'
154+
abbr -a -g grb 'git rebase'
155+
abbr -a -g grbc 'git rebase --continue'
156+
abbr -a -g grbi 'git rebase -i'
153157
abbr -a -g gco 'git checkout'
154158
abbr -a -g gsw 'git switch'
155159
abbr -a -g gswc 'git switch -c'
156-
abbr -a -g gr 'git restore'
157-
abbr -a -g grs 'git restore --staged'
160+
abbr -a -g gr 'git reset'
161+
abbr -a -g grh 'git reset HEAD'
162+
abbr -a -g gro 'git restore'
163+
abbr -a -g gros 'git restore --staged'
164+
abbr -a -g gsta 'git stash'
165+
abbr -a -g gstp 'git stash pop'
166+
abbr -a -g gt 'git tag'
167+
abbr -a -g gts 'git tag -s'
158168
abbr -a -g gg 'git log'
169+
abbr -a -g gl 'git log --oneline --decorate --graph'
170+
abbr -a -g glo 'git log --oneline'
171+
abbr -a -g gls 'git log --stat'
159172

160173
# 常用命令增强
161174
abbr -a -g mkdir 'mkdir -p'

0 commit comments

Comments
 (0)