summaryrefslogtreecommitdiff
path: root/modules/40-git
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-08-05 12:44:06 -0400
committerGalen Guyer <galen@galenguyer.com>2022-08-05 12:44:06 -0400
commitce1678ec45b4b0df1c3195b926410e62641de431 (patch)
tree1487faf99ed78e615d3ade09253f8cb4cd6e21a4 /modules/40-git
parent6c379fe0a506e4405e3e8d5f3dda4c94cbcd8496 (diff)
Add git module
Diffstat (limited to 'modules/40-git')
-rw-r--r--modules/40-git/gitconfig14
-rw-r--r--modules/40-git/install.sh21
2 files changed, 35 insertions, 0 deletions
diff --git a/modules/40-git/gitconfig b/modules/40-git/gitconfig
new file mode 100644
index 0000000..2a66c5e
--- /dev/null
+++ b/modules/40-git/gitconfig
@@ -0,0 +1,14 @@
+[user]
+ name = Galen Guyer
+ email = galen@galenguyer.com
+ signingkey = 7E54503B0CC743654BEB7187185693577B356767
+[gpg]
+ program = gpg
+[commit]
+ 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
+[push]
+ autoSetupRemote = true
diff --git a/modules/40-git/install.sh b/modules/40-git/install.sh
new file mode 100644
index 0000000..890db77
--- /dev/null
+++ b/modules/40-git/install.sh
@@ -0,0 +1,21 @@
+_script="$(realpath ${BASH_SOURCE[0]})"
+_scriptname="$(basename $_script)"
+_scriptdir="$(dirname $_script)"
+_modulename="$(basename $_scriptdir)"
+
+function preinstall() {
+ if ! [[ -x "$(command -v git)" ]]; then
+ PACKAGES+=("git")
+ fi
+}
+
+function install() {
+ # backup old file if it exists and we haven't backed it up before
+ if [[ -f "$HOME/.gitconfig" ]] && ! [[ -f "$HOME/.gitconfig.bak" ]] && ! [[ -f "$_scriptdir/.firstrun" ]]; then
+ echo "making backup"
+ cp "$HOME/.gitconfig" "$HOME/.gitconfig.bak"
+ touch "$_scriptdir/.firstrun"
+ fi
+
+ ln -f "$_scriptdir/gitconfig" "$HOME/.gitconfig"
+}