-
Notifications
You must be signed in to change notification settings - Fork 1
/
.git_bash_aliases
executable file
·80 lines (70 loc) · 2.41 KB
/
.git_bash_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
#!/bin/bash
# Some bash aliases for a better use of git, for GNU Bash v4+
# (c) 2011-2018 Lilian BESSON
# GPLv3 Licensed
# Cr@ns: http://perso.crans.org/besson
# On Bitbucket: https://bitbucket.org/lbesson/bin/
# Shortend to git
alias GitChanged='clear ; git status | grep --color=always "\(modified\|modifié\)" | less -r'
alias GitDeleted='clear ; git status | grep --color=always "\(deleted\|supprimé\)" | less -r'
alias GitAdded='clear ; git status | grep --color=always "\(added\|nouveau\)" | less -r'
alias GitSize='clear ; echo -e "\n ==> ${white}Ce dépôt git « ${green}$(basename $(pwd))${white} » pèse ${red}$(git count-objects -v -H | grep "size-pack" | sed s/"size-pack: "//)${white} sur ${u}https://BitBucket.org/lbesson/$(basename $(pwd))${U}${white}."'
# --- For Git only ---
alias g='git'
# Thanks to http://stackoverflow.com/a/4529147/5889533
function pushall() {
for i in $(git remote | sort -r); do
echo -e "git push $i ${1:-master}" "..."
git push "$i" "${1:-master}"
done;
}
function pullall() {
for i in $(git remote | sort -r); do
echo -e "git pull $i ${1:-master}" "..."
git pull "$i" "${1:-master}"
done;
}
alias ori='git pull origin master'
# --- For Git and subversion ---
function Push() {
clear
(git push "$@" && git gc) || svn update "$@"
}
function p() {
clear
git push "$@" || svn update "$@"
}
function Pull() {
clear
(pullall "$@" && git gc && [ -x git-blame-last-commit.sh ] && git-blame-last-commit.sh) || svn update "$@"
}
function s() {
clear
( git status "$@" || svn status "$@" ) | less -r
}
alias Status='s'
function wd() {
clear
git wdiff "$@" || svn diff "$@"
}
function c() {
clear
git commit -m "$@" || svn commit -m "$@"
}
alias Commit='c'
function a() {
git add "$@" || svn add "$@"
}
alias Add='a'
function add_modified() { git add $(git status --porcelain | grep '^ M' | awk '{ print $2}'); }
alias Aggressive='git gc --aggressive'
alias Sync='clear ; echo -e "Synchronizing (git push, gc, send_zamok)..."; git push; git gc --aggressive; make send_zamok; alert'
# Shortcut for fast edit of .htaccess or .gitignore files (very common situation)
alias nhtaccess='nano .htaccess -Y sh'
alias ngitignore='nano .gitignore -Y sh'
alias ngitconfig='nano .git/config'
# ^ for Push (git push) and v for Pull (git pull), as it looks like and ↑ ↓
alias ^='Push'
alias ↑='Push'
alias v='Pull'
alias ↓='Pull'