Skip to content

Commit

Permalink
🎉 init setup git config
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdhika31 committed Nov 28, 2023
1 parent 162aca4 commit a716bb2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
20 changes: 20 additions & 0 deletions git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[user]
name = Ferdhika Yudira
email = [email protected]
[url "[email protected]:"]
insteadOf = https://github.com/
[url "[email protected]:"]
insteadOf = https://gitlab.com/
[url "[email protected]:"]
insteadOf = https://gitlab.playcourt.id/
[url "[email protected]:"]
insteadOf = https://git.karismatech.net/
[fetch]
prune = true
[pull]
ff = only
[push]
default = current
[alias]
done = ! "git default; git pull; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D"
default = ! "git switch $(cat $(git rev-parse --git-dir)/refs/remotes/origin/HEAD | cut -d'/' -f4)"
24 changes: 24 additions & 0 deletions git/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env sh

TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")

echo $TIMESTAMP

if ! command -v git >/dev/null; then
echo "git not found; skipping..."
return
fi

CONFIG_HOME=~/

if test ~/dotfiles/git/config -ef $CONFIG_HOME; then
echo "git found and configured already; skipping..."
return
fi

echo "git found and not configured; configuring..."

rm -f $CONFIG_HOME.gitconfig
cp ./git/config $CONFIG_HOME.gitconfig

echo "git found and configured;"
9 changes: 9 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

mkdir -p ~/bin

for app in ./*; do
if test -d $app && test -f $app/setup.sh; then
. $app/setup.sh
fi
done

0 comments on commit a716bb2

Please sign in to comment.