diff options
author | stuebinm | 2024-03-15 17:09:35 +0100 |
---|---|---|
committer | stuebinm | 2024-03-15 17:09:35 +0100 |
commit | 127207830ac01eb3a49619d8ce1612a31a047b73 (patch) | |
tree | 4aa28f1312eea4c68c449628686e0a2aa15119a1 | |
parent | 8ef4a63053e7e1143a7c7d706d47b20fc4ac98b3 (diff) |
home: i have officially lost control of all the git repos
so I added a command to search though them :)
Should help whenever I'm not sure if I have cloned something already.
Intended usage is something like `cd (git where)`. It might be useful to
extend this so it doesn't assume everything has a remote called
`origin', but looks like my only three git repos which don't have
one (and which are not my own) where cloned via heartwood/radicle, and
I'm unlikely to need those again tbh.
… tbh, it might also be worth it to add a mass-fetch command? So much of
what I've cloned is just old stuff lying around …
Diffstat (limited to '')
-rw-r--r-- | home/home-minimal.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/home/home-minimal.nix b/home/home-minimal.nix index c265218..d6488a5 100644 --- a/home/home-minimal.nix +++ b/home/home-minimal.nix @@ -70,6 +70,15 @@ end fd $pattern | fzf --preview="glow {} --style=dark" --bind ctrl-j:preview-down,ctrl-k:preview-up,ctrl-alt-j:preview-page-down,ctrl-alt-k:preview-page-up ''; + git-where.body = '' + set gits (fd "^\\.git\$" -H) + for git in $gits + # .git may be a file (e.g. in case of standalone worktrees) + if test -d $git && contains origin (git --git-dir $git remote) + echo (git -C $git -C .. rev-parse --show-toplevel) (git --git-dir $git remote get-url origin) + end + end | fzf --preview 'git -C {1} show --no-show-signature --color=always' | cut -f1 -d" " + ''; }; }; @@ -93,6 +102,7 @@ log.showSignature = true; init.defaultBranch = "main"; alias.search = "!git log --format='tformat:%h %cs %s' --no-show-signature | fzf --multi --preview 'git show {+1}|bat -p -lpatch --color=always' | cut -f1 -d\" \" | wl-copy -n && wl-paste"; + alias.where = "!fish -c git-where"; merge.conflictStyle = "zdiff3"; push.autoSetupRemote = true; commit.verbose = true; |