Skip to content

Commit 044c3f4

Browse files
committed
🚧 work in progress
1 parent d379cba commit 044c3f4

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

aliases/git/git-aliases.nu

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,29 @@ export alias gca = git commit --verbose --all
5050
export alias gca! = git commit --verbose --all --amend
5151
export alias gcan! = git commit --verbose --all --no-edit --amend
5252
export alias gcans! = git commit --verbose --all --signoff --no-edit --amend
53-
export alias gcam = git commit --all --message
54-
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+
}
5559
export alias gcas = git commit --all --signoff
56-
export alias gcasm = git commit --all --signoff --message
60+
export def gcasm [message: string] {
61+
git commit --all --signoff --message $message
62+
}
5763
export alias gcb = git checkout -b
5864
export alias gcd = git checkout develop
5965
export alias gcf = git config --list
60-
6166
export alias gcl = git clone --recurse-submodules
6267
export alias gclean = git clean --interactive -d
6368
export def gpristine [] {
6469
git reset --hard
6570
git clean -d --force -x
6671
}
6772
export alias gcm = git checkout (git_main_branch)
68-
export alias gcmsg = git commit --message
73+
export def gcmsg [message: string] {
74+
git commit --message $message
75+
}
6976
export alias gco = git checkout
7077
export alias gcor = git checkout --recurse-submodules
7178
export alias gcount = git shortlog --summary --numbered
@@ -74,8 +81,9 @@ export alias gcpa = git cherry-pick --abort
7481
export alias gcpc = git cherry-pick --continue
7582
export alias gcs = git commit --gpg-sign
7683
export alias gcss = git commit --gpg-sign --signoff
77-
export alias gcssm = git commit --gpg-sign --signoff --message
78-
84+
export def gcssm [message: string] {
85+
git commit --gpg-sign --signoff --message $message
86+
}
7987
export alias gd = git diff
8088
export alias gdca = git diff --cached
8189
export alias gdcw = git diff --cached --word-diff
@@ -130,7 +138,12 @@ export def gpoat [] {
130138
}
131139
export alias gpod = git push origin --delete
132140
export alias gpodc = git push origin --delete (git_current_branch)
133-
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+
}
134147
export alias gpu = git push upstream
135148
export alias gpv = git push --verbose
136149

@@ -154,8 +167,12 @@ export alias grhh = git reset --hard
154167
export alias groh = git reset $"origin/(git_current_branch)" --hard
155168
export alias grm = git rm
156169
export alias grmc = git rm --cached
157-
export alias grmv = git remote rename
158-
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+
}
159176
export alias grs = git restore
160177
export alias grset = git remote set-url
161178
export alias grss = git restore --source

custom-completions/git/git-completions.nu

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def "nu-complete git checkout" [] {
6262
| append (nu-complete git remote branches with prefix
6363
| parse "{value}"
6464
| insert description "remote branch")
65+
| append (nu-complete git files | where description != "Untracked" | select value | insert description "git file")
6566
| append (nu-complete git commits all)
6667
| append (nu-complete git files | where description != "Untracked" | select value)
6768
}
@@ -463,7 +464,7 @@ export extern "git commit" [
463464
--dry-run # show paths to be committed without committing
464465
--status # include git-status output in commit message
465466
--no-status # do not include git-status output
466-
--gpg-sign(-S):string # GPG-sign commit
467+
--gpg-sign(-S) # GPG-sign commit
467468
--no-gpg-sign # do not GPG-sign commit
468469
...pathspec: string # commit files matching pathspec
469470
]
@@ -576,7 +577,7 @@ export extern "git bisect reset" [
576577

577578
# Show help for a git subcommand
578579
export extern "git help" [
579-
command: string@"nu-complete git subcommands" # subcommand to show help for
580+
command?: string@"nu-complete git subcommands" # subcommand to show help for
580581
]
581582

582583
# git worktree
@@ -687,7 +688,7 @@ export extern "git clone" [
687688
--single-branch # clone commit history from a single branch
688689
--no-single-Branch # do not clone only one branch
689690
--no-tags # do not clone any tags
690-
--recurse-submodules: string # clone the submodules
691+
--recurse-submodules # clone the submodules. Also accepts paths
691692
--shallow-submodules # shallow clone submodules with depth 1
692693
--no-shallow-submodules # do not shallow clone submodules
693694
--remote-submodules # submodules are updating using their remote tracking branch

0 commit comments

Comments
 (0)