-
Notifications
You must be signed in to change notification settings - Fork 0
/
.basic.aliases
106 lines (84 loc) · 2.92 KB
/
.basic.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
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias cls='clear'
alias .cci='mkdir .circleci && touch .circleci/config.yml'
alias .editorconfig='curl https://raw.githubusercontent.com/NdagiStanley/repo-boiler-plate/main/.editorconfig > .editorconfig'
alias d='docker'
alias dc='docker-compose'
alias di='docker images'
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gb='git branch'
alias gcd='git checkout develop'
alias gcl='git clone'
alias gcm='git checkout main'
alias gcmsg='git commit -m'
alias gco='git checkout'
alias gcl='git clone'
alias ggpull='git pull origin "$(gb --show-current)"'
alias ggpush='git push origin "$(gb --show-current)"'
alias gloga='git log --oneline --decorate --graph --all' # a for --all
alias glogat="git log --graph --all --pretty='format:%C(auto)%h %d %s (%ah)'" # at for --all & time (format:%ah)
alias gpo="git push origin"
alias gr='git remote'
alias gra='git remote add'
alias grv='git remote -v'
alias grmv='git remote rename'
alias grrm='git remote remove'
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias gss='git status -s'
alias h="history"
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias notify='tput bel'
alias ip='curl ifconfig.me'
mkd() {
mkdir -p "$@"
cd "$@" || exit
}
# Call from a local repo to echo the repository URL on github/bitbucket
# Modified version of https://github.com/zeke/ghwd
repo() {
# Figure out github repo base URL
local base_url
base_url=$(git config --get remote.origin.url)
base_url=${base_url%\.git} # remove .git from end of string
# Fix git@github.com: URLs
base_url=${base_url//git@github\.com:/https:\/\/github\.com\/}
# Fix git://github.com URLS
base_url=${base_url//git:\/\/github\.com/https:\/\/github\.com\/}
# Fix git@bitbucket.org: URLs
base_url=${base_url//git@bitbucket.org:/https:\/\/bitbucket\.org\/}
# Fix git@gitlab.com: URLs
base_url=${base_url//git@gitlab\.com:/https:\/\/gitlab\.com\/}
echo $base_url
# Validate that this folder is a git folder
if ! git branch 2>/dev/null 1>&2 ; then
echo "Not a git repo!"
fi
# Find current directory relative to .git parent
full_path=$(pwd)
git_base_path=$(cd "./$(git rev-parse --show-cdup)" || exit 1; pwd)
relative_path=${full_path#$git_base_path} # remove leading git_base_path from working directory
# If filename argument is present, append it
if [ "$1" ]; then
relative_path="$relative_path/$1"
fi
echo $relative_path
# Figure out current git branch
branch=$(git branch --show-current)
[[ $base_url == *bitbucket* ]] && tree="src" || tree="tree"
url="$base_url/$tree/$branch$relative_path"
echo "GO TO $url"
}