summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-11-01 20:01:56 -0400
committerGalen Guyer <galen@galenguyer.com>2022-11-01 20:01:56 -0400
commit0752767c04a7816f5818987568d6ac5aaa810fc0 (patch)
tree8b354724292a28d5db9148c7e3a6d3981bc257a3
parent7869b408e62a1c6e022fac4899fc541abe530c1f (diff)
I've been writing git aliases for 5 hours. Send help
-rw-r--r--modules/40-git/gitconfig22
-rw-r--r--modules/40-git/install.sh3
2 files changed, 20 insertions, 5 deletions
diff --git a/modules/40-git/gitconfig b/modules/40-git/gitconfig
index 18743ad..4ab3320 100644
--- a/modules/40-git/gitconfig
+++ b/modules/40-git/gitconfig
@@ -1,23 +1,35 @@
[user]
- name = Galen Guyer
- email = galen@galenguyer.com
- signingkey = 7E54503B0CC743654BEB7187185693577B356767
+ name = Galen Guyer
+ email = galen@galenguyer.com
+ signingkey = 7E54503B0CC743654BEB7187185693577B356767
[gpg]
program = gpg
[commit]
gpgsign = true
+[tag]
+ gpgsign = true
[pull]
rebase = true
[alias]
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
+ edit-alias = "!f() {\n\t_tmpfile=\"$(mktemp --tmpdir git-alias-$@.XXXXX.sh)\"\n\tgit config --global --get alias.\"$@\" > \"$_tmpfile\"\n\t_startsum=$(md5sum \"$_tmpfile\" | cut -d' ' -f1)\n\t$EDITOR \"$_tmpfile\"\n\t_finalsum=$(md5sum \"$_tmpfile\" | cut -d' ' -f1)\n\tif [[ \"$_startsum\" != \"$_finalsum\" ]]; then\n\t\tgit config --global alias.\"$@\" \"$(cat $_tmpfile)\"\n\telse\n\t\techo \"Alias not modified\" >&2\n\tfi\n\trm \"$_tmpfile\"\n}; f"
+ fdiff = "!f() {\n\tif command -v fzf 2>&1 >/dev/null; then\n\t\tPREVIEW=\"{ if [[ \\\"{+}\\\" == *\\\"{}\\\"* ]]; then\n\t\t\t\tgit diff --color=always $@ -- {+};\n\t\t\telse\n\t\t\t\tgit diff --color=always $@ -- {};\n\t\t\tfi } | /usr/share/git/diff-highlight/diff-highlight\"\n\t\tgit diff \"$@\" --name-only | \\\n\t\t\tfzf \\\n\t\t\t\t--scheme=path \\\n\t\t\t\t--layout=reverse \\\n\t\t\t\t--info=inline \\\n\t\t\t\t--multi \\\n\t\t\t\t--cycle \\\n\t\t\t\t--header=\"git diff $@\" \\\n\t\t\t\t--header-first \\\n\t\t\t\t--filepath-word \\\n\t\t\t\t--ansi \\\n\t\t\t\t--preview-window=\"60%,wrap\" \\\n\t\t\t\t--preview \"$PREVIEW\" \\\n\t\t\t\t--bind=\"enter:execute(less {})\"\n\telse\n\t\techo \"fzf not found, using normal diff\" >&2\n\t\tgit diff \"$@\"\n\tfi\n}; f"
+ gce = config --global --edit
+ ce = config --edit
[push]
autoSetupRemote = true
[blame]
ignoreRevsFile = .git-blame-ignore-revs
+[pager]
+ diff = /usr/share/git/diff-highlight/diff-highlight | less
+ log = /usr/share/git/diff-highlight/diff-highlight | less
+ tree = /usr/share/git/diff-highlight/diff-highlight | less
+[interactive]
+ diffFilter = /usr/share/git/diff-highlight/diff-highlight
+[lfs]
+ url = "https://lfs.galenguyer.com"
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
-[lfs]
- url = "https://lfs.galenguyer.com"
diff --git a/modules/40-git/install.sh b/modules/40-git/install.sh
index 61374e9..1e062bc 100644
--- a/modules/40-git/install.sh
+++ b/modules/40-git/install.sh
@@ -8,6 +8,9 @@ function preinstall() {
if ! [[ -x "$(command -v git)" ]]; then
PACKAGES+=("git")
fi
+ if ! [[ -x "$(command -v fzf)" ]]; then
+ PACKAGES+=("fzf")
+ fi
}
function install() {