1+ # returns the name of the current branch
12export def git_current_branch [] {
2- ( gstat ) .branch
3+ ^ git rev-parse -- abbrev-ref HEAD
34}
45
56export def git_main_branch [] {
@@ -49,22 +50,29 @@ export alias gca = git commit --verbose --all
4950export alias gca! = git commit -- verbose -- all -- amend
5051export alias gcan! = git commit -- verbose -- all -- no-edit -- amend
5152export alias gcans! = git commit -- verbose -- all -- signoff -- no-edit -- amend
52- export alias gcam = git commit -- all -- message
53- export alias gcsm = git commit -- signoff -- message
53+ export def gcam [message : string ] {
54+ git commit -- all -- message $message
55+ }
56+ export def gcsm [message : string ] {
57+ git commit -- all -- signoff $message
58+ }
5459export alias gcas = git commit -- all -- signoff
55- export alias gcasm = git commit -- all -- signoff -- message
60+ export def gcasm [message : string ] {
61+ git commit -- all -- signoff -- message $message
62+ }
5663export alias gcb = git checkout - b
5764export alias gcd = git checkout develop
5865export alias gcf = git config -- list
59-
6066export alias gcl = git clone -- recurse-submodules
6167export alias gclean = git clean -- interactive - d
6268export def gpristine [] {
6369 git reset -- hard
6470 git clean - d -- force - x
6571}
6672export alias gcm = git checkout (git_main_branch )
67- export alias gcmsg = git commit -- message
73+ export def gcmsg [message : string ] {
74+ git commit -- message $message
75+ }
6876export alias gco = git checkout
6977export alias gcor = git checkout -- recurse-submodules
7078export alias gcount = git shortlog -- summary -- numbered
@@ -73,8 +81,9 @@ export alias gcpa = git cherry-pick --abort
7381export alias gcpc = git cherry-pick -- continue
7482export alias gcs = git commit -- gpg-sign
7583export alias gcss = git commit -- gpg-sign -- signoff
76- export alias gcssm = git commit -- gpg-sign -- signoff -- message
77-
84+ export def gcssm [message : string ] {
85+ git commit -- gpg-sign -- signoff -- message $message
86+ }
7887export alias gd = git diff
7988export alias gdca = git diff -- cached
8089export alias gdcw = git diff -- cached -- word-diff
@@ -129,7 +138,12 @@ export def gpoat [] {
129138}
130139export alias gpod = git push origin -- delete
131140export alias gpodc = git push origin -- delete (git_current_branch )
132- export alias gpr = git pull -- rebase
141+ def "nu-complete git pull rebase" [] {
142+ [" false" ," true" ," merges" ," interactive" ]
143+ }
144+ export def gpr [rebase_type : string @" nu-complete git pull rebase" ] {
145+ git pull -- rebase $rebase_type
146+ }
133147export alias gpu = git push upstream
134148export alias gpv = git push -- verbose
135149
@@ -153,10 +167,16 @@ export alias grhh = git reset --hard
153167export alias groh = git reset $" origin/(git_current_branch )" -- hard
154168export alias grm = git rm
155169export alias grmc = git rm -- cached
156- export alias grmv = git remote rename
157- export alias grrm = git remote remove
170+ export def grmv [remote : string , new_name : string ] {
171+ git remote rename $remote $new_name
172+ }
173+ export def grrm [remote : string ] {
174+ git remote remove $remote
175+ }
158176export alias grs = git restore
159- export alias grset = git remote set-url
177+ export def grset [remote : string , url : string ] {
178+ git remote set-url $remote $url
179+ }
160180export alias grss = git restore -- source
161181export alias grst = git restore -- staged
162182export alias grt = cd (git rev-parse -- show-toplevel or echo . )
@@ -194,18 +214,24 @@ export def gtv [] {
194214export alias glum = git pull upstream (git_main_branch )
195215
196216export alias gunignore = git update-index -- no-assume-unchanged
197- export alias gup = git pull -- rebase
217+ export def gup [rebase_type : string @" nu-complete git pull rebase" ] {
218+ git pull -- rebase $rebase_type
219+ }
198220export alias gupv = git pull -- rebase -- verbose
199221export alias gupa = git pull -- rebase -- autostash
200222export alias gupav = git pull -- rebase -- autostash -- verbose
201223
202224export alias gwch = git whatchanged - p -- abbrev-commit -- pretty=medium
203225
204226export alias gwt = git worktree
205- export alias gwta = git worktree add
227+ export def gwta [path : path , branch : string ] {
228+ git worktree add $path $branch
229+ }
206230export alias gwtls = git worktree list
207231export alias gwtmv = git worktree move
208- export alias gwtrm = git worktree remove
232+ export def gwtm [worktree : string ] {
233+ git worktree remove $worktree
234+ }
209235
210236export alias gam = git am
211237export alias gamc = git am -- continue
0 commit comments