forked from danieluhl/dotfiles-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliases
140 lines (118 loc) · 3.76 KB
/
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# install vim plugins
alias plug-install='vim -u "$HOME"/.vimrc.bundles +PlugInstall +PlugClean! +qa'
# git
alias reload!='. ~/.zshrc && . ~/.zshrc.local'
alias rebuild!='rcdn -vd ~/git/dotfiles/dotfiles-1 && rcdn -vd ~/git/dotfiles/dotfiles-local && rcup -vd ~/git/dotfiles/dotfiles-1 && rcup -vd ~/git/dotfiles/dotfiles-local'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gclear='git checkout -- . && git status'
#logging
alias glm='git log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --committer="duhl"'
alias gl="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias glh='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
# committing
alias gc='git commit -m'
alias ga='git add -A'
alias gca='git add -A && git commit -m'
alias gcin='git add -A && git commit -n -m'
alias gcamend='git commit --amend'
alias guc='git reset --soft HEAD~1'
alias gremove='git reset HEAD && git status'
# !!DANGER!! will lose changes
alias grevertall='git reset --hard HEAD~1'
# pushing and pulling
alias gpush='git push origin HEAD'
alias gp='git pull'
alias gpr='git pull --rebase --prune'
alias gf='git fetch --all'
alias gpp='gpr && gpush'
# ignore files
alias gignore="git update-index --assume-unchanged"
alias gstopignore="git update-index --no-assume-unchanged"
alias gco='git checkout'
alias gcom='git checkout master'
alias gm='git checkout master'
alias gcomp='gcom && gpr'
alias gmp='gm && gpr'
# clean directory
alias gcl='git clean -fdx'
# branches
alias gcb='git copy-branch-name'
alias gbd='git branch -D'
alias gb='printBranches'
alias gbm='git branch -m' # rename a branch
alias createremote="createRemoteBranch"
alias deleteremote="deleteRemoteBranch"
alias pushremote="pushRemoteBranch"
alias gs='git status' # upgrade your git if -sb breaks for you. it's fun.
alias gremote='git remote set-url origin git@github.com/danieluhl/' # last param should be the github repo name.git - git@github.com/danieluhl/my_repo.git
alias gm='git merge'
alias gmm='git merge master --no-edit'
alias gms='git merge --squash'
# diffing
alias gd='git diff'
alias gds='git diff --staged'
alias gdn="git diff --name-only master"
# ********** non git ***********
alias c='clear'
alias lsa='ls -la'
alias toucheverything='find . -exec touch {} \; &'
# open in sublime
alias subl='open -a Sublime\ Text '
alias stt='subl .'
alias pf='open -a "path finder" ./'
# call functions
alias go="changeDirectory"
alias deps="traceDependenciesByLeaf"
# functions
function changeDirectory()
{
eval "cd ~/git/$1";
}
# traces all dependencies to see if they're there
function traceDependenciesByLeaf()
{
eval "grunt deps --depth 1 --leaf $1"
}
function printBranches()
{
eval 'for k in `git branch | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cred%cr%Creset" $k --`\\t"$k";done | sort'
}
# pushes the current branch to the same named remote
function pushRemoteBranch()
{
currentBranch="$(git symbolic-ref HEAD 2>/dev/null)";
currentBranch=${currentBranch##refs/heads/}
eval "git push origin $currentBranch";
}
# create a remote branch and set upstream
function createRemoteBranch()
{
eval "git push -u origin $1:$1";
}
# delete a remote branch
function deleteRemoteBranch()
{
eval "git push origin :$1";
}
function deleteBranch()
{
eval "git branch -D $1";
eval "gb";
}
# git: alias `g` to `git`
# if called with no arguments run `git status`
unalias g
g() {
if [[ $# > 0 ]]; then
git $@
else
git status
fi
}
compdef g=git
# simple server
alias serve='python -m SimpleHTTPServer 8000'
alias localhost='open -a "Google Chrome" "http://localhost:8000"'
# Include custom aliases
[[ -f ~/.aliases.local ]] && source ~/.aliases.local