git alias ga
This commit is contained in:
parent
f7b7a2a518
commit
d6b8d7e0ae
@ -8,7 +8,7 @@ zsh:.config/zsh .zshenv .zshenv.d .inputrc %colors
|
|||||||
alacritty:.config/alacritty
|
alacritty:.config/alacritty
|
||||||
nvim:.config/nvim .editorconfig .editrc .local/bin/vim_askpass_helper
|
nvim:.config/nvim .editorconfig .editrc .local/bin/vim_askpass_helper
|
||||||
ssh:
|
ssh:
|
||||||
git:.config/git
|
git:.config/git .local/bin/ga
|
||||||
ranger:.config/ranger
|
ranger:.config/ranger
|
||||||
gpg:
|
gpg:
|
||||||
i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3status .local/bin/i3status_wrapper .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces
|
i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3status .local/bin/i3status_wrapper .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
a = "!git ls-files --exclude-standard --modified -t | fzf -1 -0 -m --bind load:last --preview 'git diff --color=always {2}' | cut -d' ' -f2 | xargs git add"
|
a = "!ga"
|
||||||
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
|
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged"
|
||||||
msg = log -1 --pretty=%B
|
msg = log -1 --pretty=%B
|
||||||
d = diff
|
d = diff
|
||||||
|
|||||||
@ -76,7 +76,7 @@ alias vi='nvim'
|
|||||||
alias svi="sudo --preserve-env nvim"
|
alias svi="sudo --preserve-env nvim"
|
||||||
|
|
||||||
# git
|
# git
|
||||||
for al in s d di co col cob ds a u ps pl pr hs last lastd df amend br fuck
|
for al in s d di co col cob ds u ps pl pr hs last lastd df amend br fuck
|
||||||
do
|
do
|
||||||
alias "g${al}"="git ${al}"
|
alias "g${al}"="git ${al}"
|
||||||
done
|
done
|
||||||
|
|||||||
28
home/user/.local/bin/ga
Executable file
28
home/user/.local/bin/ga
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
_fzf_base() {
|
||||||
|
fzf -0 -m --bind load:last "${@}" | cut -d' ' -f2
|
||||||
|
}
|
||||||
|
|
||||||
|
fzf_get_selected_modified() {
|
||||||
|
_fzf_base -1 --border-label=' Modified ' --preview 'git diff --color=always {2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
fzf_get_selected_untracked() {
|
||||||
|
_fzf_base --border-label=' Untracked ' --preview 'highlight -O xterm256 {2}'
|
||||||
|
}
|
||||||
|
|
||||||
|
gitadd() {
|
||||||
|
xargs git add
|
||||||
|
}
|
||||||
|
|
||||||
|
git_ls_files() {
|
||||||
|
git ls-files --exclude-standard -t "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
modified_files="$(git_ls_files --modified)"
|
||||||
|
printf "%s" "${modified_files}" | fzf_get_selected_modified | gitadd
|
||||||
|
|
||||||
|
untracked_files="$(git_ls_files --others)"
|
||||||
|
printf "%s" "${untracked_files}" | fzf_get_selected_untracked | gitadd
|
||||||
Loading…
x
Reference in New Issue
Block a user