-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitc
More file actions
executable file
·68 lines (50 loc) · 1.71 KB
/
gitc
File metadata and controls
executable file
·68 lines (50 loc) · 1.71 KB
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
67
#!/bin/sh
# A fast way (one line command) to run gitc commit with messages
# This script runs git pull before you try to commit.
# This way you reduce conflicts.
# Put this gitc file in your ~/bin/ ($HOME/bin) folder
# Run: chmod 700 ~/bin/gitc
# (all script must be in executable 700 mode)
# If you use bash for your shell, open your ~/.bashrc file (or create one)
# and add this line to your ~/.bashrc
# PATH="~/bin:$PATH"
# and then run bash again in your shell so your .bashrc is reloaded
# or just exist the current shell, and open a new one
# If you use csh as your shell, then modify your ~/.cshrc appropriately
# similar to above.
# no arg, mean this prints the instruction
if [ $# == 0 ]; then
echo ""
echo " Use : gitc <commit message in one line> "
echo " Ex : gitc I added some new code "
echo ""
exit
fi
# update first
echo "\n-------------------------------------- git pull"
git pull
# status
echo "\n-------------------------------------- git status"
git status
# add all updated file ( no need since we already use git commit -a)
# echo "\n-------------------------------------- git add -u * "
# git add -u *
# the commit message, if you supply "gitc ." then "." means No message
msg="$*"
if [ "$msg" == "." ]; then
msg="No message"
echo "Existing. Just checking, git pull, with 'gitc .' "
exit
fi
# commit
echo "\n-------------------------------------- git commit -m $USER: $msg"
git commit -a -m "$USER: $msg"
# push
echo "\n-------------------------------------- git push "
git push
# git log HEAD
echo "\n-------------------------------------- git log HEAD"
git log HEAD | head -n 10
# git status
echo "\n-------------------------------------- git status"
git status