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

REFACTOR: unify git modules and aliases (#472)

* add aliases from `modules/git/`

* remove `git` aliases from `modules/git/`

* move the `git_` tool commands to the alias file

This is the only place these commands are used.
This commit is contained in:
Antoine Stevan 2023-04-30 14:23:07 +02:00 committed by GitHub
parent 4e07d66d06
commit 1099c9461e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 134 deletions

View file

@ -1,3 +1,16 @@
def git_current_branch [] {
(gstat).branch
}
def git_main_branch [] {
git remote show origin
| lines
| str trim
| find --regex 'HEAD .*?[: ].+'
| first
| str replace 'HEAD .*?[: ](.+)' '$1'
}
#
# Aliases
# (sorted alphabetically)
@ -37,11 +50,13 @@ export alias gcsm = git commit -s -m
export alias gcas = git commit -a -s
export alias gcasm = git commit -a -s -m
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 -id
export alias gpristine = ((git reset --hard); (git clean -dffx))
export alias gcm = git checkout (git_main_branch)
export alias gcmsg = git commit -m
export alias gco = git checkout
export alias gcor = git checkout --recurse-submodules
@ -72,7 +87,7 @@ export alias ghh = git help
export alias gignore = git update-index --assume-unchanged
export alias gl = git pull
export alias gl = git log
export alias glg = git log --stat
export alias glgp = git log --stat -p
export alias glgg = git log --graph
@ -86,29 +101,39 @@ export alias gm = git merge
export alias gmtl = git mergetool --no-prompt
export alias gmtlvim = git mergetool --no-prompt --tool=vimdiff
export alias gma = git merge --abort
export def gmom [] {
let main = (git_main_branch)
git merge $"origin/($main)"
}
export alias gp = git push
export alias gpd = git push --dry-run
export alias gpf = git push --force-with-lease
export alias gpf! = git push --force
export alias gpl = git pull
export alias gpoat = (git push origin --all; git push origin --tags)
export alias gpr = git pull --rebase
export alias gpu = git push upstream
export alias gpv = git push -v
export alias gr = git remote
export alias gpra = git pull --rebase --autostash
export alias gprav = git pull --rebase --autostash -v
export alias gprv = git pull --rebase -v
export alias gpsup = git push --set-upstream origin (git_current_branch)
export alias gra = git remote add
export alias grb = git rebase
export alias grba = git rebase --abort
export alias grbc = git rebase --continue
export alias grbd = git rebase develop
export alias grbi = git rebase -i
export alias grbm = git rebase (git_main_branch)
export alias grbo = git rebase --onto
export alias grbs = git rebase --skip
export alias grev = git revert
export alias grh = git reset
export alias grhh = git reset --hard
# export alias groh = (get_current_branch | git reset origin/$in --hard)
export alias groh = get_current_branch
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
@ -145,6 +170,7 @@ export alias gswc = git switch -c
export alias gts = git tag -s
export alias gtv = (git tag | lines | sort)
export alias glum = git pull upstream (git_main_branch)
export alias gunignore = git update-index --no-assume-unchanged
export alias gup = git pull --rebase