update git config

This commit is contained in:
chenyc 2022-12-14 16:10:32 +08:00
parent 05dbffc176
commit b203fb309e
2 changed files with 30 additions and 2 deletions

View File

@ -94,6 +94,28 @@ _OMZ_APPLY_CHPWD_HOOK
5. fzf-tab 5. fzf-tab
> tab时使用fzf进行候选选择 > tab时使用fzf进行候选选择
6. 常用git命令支持(非插件)
> `gco` = `git checkout`
> `gpo` = `git push origin <当前分支>`
> `gpl` = `git pull origin <当前分支>`
> `gd` = `git diff`
> `gs` = `git status`
> `gss` = `更简洁的 git status`
> `gam` = `git add all 并 git commit -m '内容'`, e.g. `git commit update readme`
> `gll` = `简洁打印 git log`, 默认展示10条 若想展示更多 `gll 100`
> `glll` = `详细打印 git log`, 默认展示10条 若想展示更多 `glll 100`
>> 展示 glll效果如下 PS: 实际使用带颜色 可自行根据 [此文件:git.zsh](https://github.com/yaocccc/omz/blob/master/config/git.zsh) 内容配置对应颜色
>>
>> $ glll
>> \* e797da3 2022-12-14 15:18 user1: fix: 透传减轻下游负载
>> \* ed8a8ba 2022-12-14 14:41 user1: fix: 查询时透传id
>> \* 7c2799b 2022-12-13 19:04 user1: Merge branch 'abc' into 'master'
>> |\
>> | * 3f2441b 2022-12-13 19:01 user1: fix: 修复安全隐患
>> |/
>> \* 70a46da 2022-12-13 18:27 user2: Merge branch 'fix/abcd' into 'master'
## FILE TREE ## FILE TREE
```plaintext ```plaintext

View File

@ -1,5 +1,11 @@
export GIT_TERMINAL_PROMPT=1 export GIT_TERMINAL_PROMPT=1
# 可配置以下环境变量控制git log颜色
hashColor=${gitHashColor:-"magenta"}
contentColor=${gitContentColor:-"cyan"}
dateColor=${gitDateColor:-"yellow"}
authorColor=${gitAuthorColor:-"blue"}
alias gco='git checkout' alias gco='git checkout'
alias gpo='git push origin $(git symbolic-ref --short -q HEAD)' alias gpo='git push origin $(git symbolic-ref --short -q HEAD)'
alias gpl='git pull origin $(git symbolic-ref --short -q HEAD) --ff-only' alias gpl='git pull origin $(git symbolic-ref --short -q HEAD) --ff-only'
@ -13,5 +19,5 @@ gam() { git add --all && git commit -m "$*" }
gitlog() { gitlog() {
git --no-pager log --date=format:'%Y-%m-%d %H:%M' --pretty=format:$1 --graph -n ${2-10} \ git --no-pager log --date=format:'%Y-%m-%d %H:%M' --pretty=format:$1 --graph -n ${2-10} \
} }
gll() { gitlog "%C(magenta)%h %C(cyan)%s%Creset" $1 } gll() { gitlog "%C(${hashColor})%h %C(${contentColor})%s%Creset" $1 }
glll() { gitlog "%C(magenta)%h %C(yellow)%cd %Cblue%cn: %C(cyan)%s%Creset" $1 } glll() { gitlog "%C(${hashColor})%h %C(${dateColor})%cd %C(${authorColor})%cn: %C(${contentColor})%s%Creset" $1 }