-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·26 lines (19 loc) · 805 Bytes
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·26 lines (19 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# Check for git installation
if ! command -v git &>/dev/null; then
echo "Git is not installed! Please install Git first."
exit 1
fi
# Clone the dotfiles
git clone --bare https://github.com/afgallo/dotfiles.git $HOME/.dotfiles
# Define the alias
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >>$HOME/.zshrc
# Backup existing config
mkdir -p $HOME/.dotfiles-backup
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} $HOME/.dotfiles-backup/{}
# Checkout dotfiles
dotfiles checkout
# Set flag to hide untracked files
dotfiles config --local status.showUntrackedFiles no
echo "Dotfiles have been setup! Original config backed up in ~/.dotfiles-backup"