-
Notifications
You must be signed in to change notification settings - Fork 0
/
link-git.sh
executable file
·66 lines (48 loc) · 1.48 KB
/
link-git.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo
echo
echo "${green}---------------------------${reset}"
echo "${green}--- link-git ---${reset}"
echo "${green}---------------------------${reset}"
echo
source ./.env
function fun_link() {
echo " - 🔍 is target exist? : \`${green}${target_file}${reset}\`"
if [ -e "${target_file}" ]; then
echo "⭕️${green}.gitconfig files found.${reset}"
else
echo " - 🔍 is source exist? : \`${green}${source_file}${reset}\`"
if [ -e "${source_file}" ]; then
echo "‼.gitconfig files not found! ready to create link...."
echo "ln -s ${source_file} ${target_file}"
ln -s "${source_file}" "${target_file}"
else
echo "❌${red}source not exist...${reset}"
fi
fi
}
source_file="$SOURCE_ROOT_PATH/System/.gitconfig"
target_file="/Users/$USER/.gitconfig"
echo "🧪 try: ln -s ${source_file} ${target_file}"
fun_link $source_file $target_file
echo
echo "${green}use 'git config --list' list your config...${reset}"
echo
echo
#
source_file="$SOURCE_ROOT_PATH/System/.gitignore_global"
target_file="/Users/$USER/.gitignore_global"
echo "🧪 try: ln -s ${source_file} ${target_file}"
fun_link $source_file $target_file
echo
echo "${green}use 'git config --global core.excludesfile' your config...${reset}"
echo
echo
echo "${green}-------------${reset}"
echo "${green}--- Done. ---${reset}"
echo "${green}-------------${reset}"
echo
echo