-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit-aliases
executable file
·110 lines (82 loc) · 3.37 KB
/
git-aliases
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
echo "Setting git aliases..."
#read -p "Continue? Will overwrite any conflicting aliases... [yN]" yn
echo -e "\nCurrent git global email: "
git config --global user.email
read -p "What's your email for git? " email
if [[ $email != "" ]]; then
git config --global user.email "$email"
fi
echo -e "\nCurrent git global name: "
git config --global user.name
read -p "What's your name for git? " name
if [[ $name != "" ]]; then
git config --global user.name "$name"
fi
echo -e "\nTell git pull to automatically merge from the current branch"
git config --global branch.autosetupmerge true
echo -e "\nTell git pull to rebase by default. (No one likes merge commits with yourself)"
git config --global pull.rebase true
# Don't do this for now because it doesn't work with older versions of git
#echo -e "\nUse the new Git 2.0 default setting of simple push (safest for beginners)"
#git config --global push.default simple
echo -e "\nDefault git editor is vim"
git config --global core.editor "vim"
echo -e "\nSetup color syntax for git"
git config --global color.ui true
echo -e "\nUse a tab-width of 4 for git diff"
git config --global core.pager "less -x4 -S"
echo -e "\ngit s ==> Status"
git config --global --unset-all alias.s
git config --global alias.s status
echo "git b ==> Branch (all)"
git config --global --unset-all alias.b
git config --global alias.b "branch -a"
echo "git ci ==> Commit"
git config --global --unset-all alias.ci
git config --global alias.ci commit
echo -e "git undo ==> Undo last commit"
git config --global --unset-all alias.undo
git config --global alias.undo "reset --soft HEAD^"
echo "git co ==> Checkout"
git config --global --unset-all alias.co
git config --global alias.co checkout
echo "git a ==> Add"
git config --global --unset-all alias.a
git config --global alias.a "add"
echo "git d ==> Diff"
git config --global --unset-all alias.d
git config --global alias.d "diff --word-diff"
echo "git ds ==> Diff Staged"
git config --global --unset-all alias.ds
git config --global alias.ds "diff --staged --word-diff"
echo "git df ==> File diff"
git config --global --unset-all alias.df
git config --global alias.df "diff --name-only"
echo "git dd ==> Diff stats"
git config --global --unset-all alias.dd
git config --global alias.dd "diff --stat"
echo "git f ==> Fetch"
git config --global --unset-all alias.f
git config --global alias.f "fetch --tags --prune"
echo "git p ==> Pull"
git config --global --unset-all alias.p
git config --global alias.p pull
echo "git lol ==> Better log"
git config --global --unset-all alias.lol
git config --global alias.lol "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short --all -1000"
echo "git unstash ==> Unstash (git stash pop)"
git config --global --unset-all alias.unstash
git config --global alias.unstash "stash pop"
echo "git ignore ==> Assume a file is unchanged"
git config --global --unset-all alias.ignore
git config --global alias.ignore "update-index --assume-unchanged"
echo "git r/rebase ==> Pull and rebase"
git config --global --unset-all alias.rebase
git config --global --unset-all alias.r
git config --global alias.r "pull --rebase"
git config --global alias.rebase "pull --rebase"
echo "git rc ==> Rebase --continue"
git config --global --unset-all alias.rc
git config --global alias.rc "rebase --continue"
echo -e "\nAll done."