[feat] add link script

This commit is contained in:
Jay 2021-01-16 11:14:32 +08:00
parent 034c3500e3
commit adb1f36c83
2 changed files with 28 additions and 0 deletions

View File

@ -20,3 +20,5 @@
br = branch br = branch
[mergetool] [mergetool]
keepBackup = false keepBackup = false
[core]
editor = vim

26
mklink.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
if [ -f "$HOME/.vimrc" ]; then
# backup old file
mv "$HOME/.vimrc" "$HOME/.vimrc.old"
fi
ln -sf "`pwd`/.vimrc" "$HOME/.vimrc"
if [ -f "$HOME/.gitconfig" ]; then
# backup old file
mv "$HOME/.gitconfig" "$HOME/.gitconfig.old"
fi
ln -sf "`pwd`/.gitconfig" "$HOME/.gitconfig"
if [ ! -d "$HOME/.ssh" ]; then
mkdir -p "$HOME/.ssh"
fi
if [ -f "$HOME/.ssh/config" ]; then
# backup old file
mv "$HOME/.ssh/config" "$HOME/.ssh/config.old"
fi
cp "`pwd`/.ssh/config" "$HOME/.ssh/config"