1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-03 07:37:47 +00:00

remove gstat dependency from git-aliases (#1020)

I removed `gstat` plugin dependency need by replacing the command.

~~The only problem is that the aliases don't work for the current
nushell version~~
Done!


fixes #973 and closes #974
This commit is contained in:
Auca Coyan 2025-01-25 16:23:57 -03:00 committed by GitHub
parent 759218de6f
commit b42f2bd5c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 18 deletions

View file

@ -1,5 +1,6 @@
# returns the name of the current branch
export def git_current_branch [] {
(gstat).branch
^git rev-parse --abbrev-ref HEAD
}
export def git_main_branch [] {
@ -49,14 +50,19 @@ export alias gca = git commit --verbose --all
export alias gca! = git commit --verbose --all --amend
export alias gcan! = git commit --verbose --all --no-edit --amend
export alias gcans! = git commit --verbose --all --signoff --no-edit --amend
export alias gcam = git commit --all --message
export alias gcsm = git commit --signoff --message
export def gcam [message: string] {
git commit --all --message $message
}
export def gcsm [message: string] {
git commit --all --signoff $message
}
export alias gcas = git commit --all --signoff
export alias gcasm = git commit --all --signoff --message
export def gcasm [message: string] {
git commit --all --signoff --message $message
}
export alias gcb = git checkout -b
export alias gcd = git checkout develop
export alias gcf = git config --list
export alias gcl = git clone --recurse-submodules
export alias gclean = git clean --interactive -d
export def gpristine [] {
@ -64,7 +70,9 @@ export def gpristine [] {
git clean -d --force -x
}
export alias gcm = git checkout (git_main_branch)
export alias gcmsg = git commit --message
export def gcmsg [message: string] {
git commit --message $message
}
export alias gco = git checkout
export alias gcor = git checkout --recurse-submodules
export alias gcount = git shortlog --summary --numbered
@ -73,8 +81,9 @@ export alias gcpa = git cherry-pick --abort
export alias gcpc = git cherry-pick --continue
export alias gcs = git commit --gpg-sign
export alias gcss = git commit --gpg-sign --signoff
export alias gcssm = git commit --gpg-sign --signoff --message
export def gcssm [message: string] {
git commit --gpg-sign --signoff --message $message
}
export alias gd = git diff
export alias gdca = git diff --cached
export alias gdcw = git diff --cached --word-diff
@ -129,7 +138,12 @@ export def gpoat [] {
}
export alias gpod = git push origin --delete
export alias gpodc = git push origin --delete (git_current_branch)
export alias gpr = git pull --rebase
def "nu-complete git pull rebase" [] {
["false","true","merges","interactive"]
}
export def gpr [rebase_type: string@"nu-complete git pull rebase"] {
git pull --rebase $rebase_type
}
export alias gpu = git push upstream
export alias gpv = git push --verbose
@ -153,10 +167,16 @@ export alias grhh = git reset --hard
export alias groh = git reset $"origin/(git_current_branch)" --hard
export alias grm = git rm
export alias grmc = git rm --cached
export alias grmv = git remote rename
export alias grrm = git remote remove
export def grmv [remote: string, new_name: string] {
git remote rename $remote $new_name
}
export def grrm [remote: string] {
git remote remove $remote
}
export alias grs = git restore
export alias grset = git remote set-url
export def grset [remote: string, url: string] {
git remote set-url $remote $url
}
export alias grss = git restore --source
export alias grst = git restore --staged
export alias grt = cd (git rev-parse --show-toplevel or echo .)
@ -194,7 +214,9 @@ export def gtv [] {
export alias glum = git pull upstream (git_main_branch)
export alias gunignore = git update-index --no-assume-unchanged
export alias gup = git pull --rebase
export def gup [rebase_type: string@"nu-complete git pull rebase"] {
git pull --rebase $rebase_type
}
export alias gupv = git pull --rebase --verbose
export alias gupa = git pull --rebase --autostash
export alias gupav = git pull --rebase --autostash --verbose
@ -202,10 +224,14 @@ export alias gupav = git pull --rebase --autostash --verbose
export alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
export alias gwt = git worktree
export alias gwta = git worktree add
export def gwta [path: path, branch: string] {
git worktree add $path $branch
}
export alias gwtls = git worktree list
export alias gwtmv = git worktree move
export alias gwtrm = git worktree remove
export def gwtm [worktree: string] {
git worktree remove $worktree
}
export alias gam = git am
export alias gamc = git am --continue