-
Notifications
You must be signed in to change notification settings - Fork 4
/
git-setting.sh
executable file
·55 lines (45 loc) · 1.42 KB
/
git-setting.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
#!/bin/bash
#######################################################################################
## Project : Collect of various scripts for working with EDA-tools (ASIC/FPGA/etc)
## Designer : Dmitry Murzinov (kakstattakim@gmail.com)
## Link : https://github.com/iDoka/eda-scripts
## Module : git-setting.sh
## Description: Initial git settings of repository
## Usage : refer to git-setting.adoc for usage help
## Revision : $Rev
## Date : $LastChangedDate$
## License : MIT
#######################################################################################
#### check passing path
if [ -z "$1" ]; then
echo "No path to repository supplied. Exit."
exit 1
fi
###### variables
CWD=`pwd`
GIT_DIR=$1
GIT_USER=`finger $USER | head -1 | cut -d: -f3 | sed 's/^[ ]*//'`
GIT_MAIL=${USER}@${HOSTNAME}.com
########## assembly .gitignore
rm -f ${GIT_DIR}/.gitignore
for f in gitignore/*.gitignore
do
sed '1,8d' $f | cat >> ${GIT_DIR}/.gitignore
done
########## assembly .gitattributes
rm -f ${GIT_DIR}/.gitattributes
for f in gitattributes/*.gitattributes
do
sed '1,8d' $f | cat >> ${GIT_DIR}/.gitattributes
done
########## git repo setting
cd ${GIT_DIR}
git init
git config user.name "${GIT_USER}"
git config user.email ${GIT_MAIL}
git config color.ui true
git config format.pretty oneline
git add .gitattributes .gitignore
git commit -m "[git] settings was added"
cd ${CWD}
echo "Done!"