forked from w0rp/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaliases
More file actions
executable file
·61 lines (52 loc) · 2.42 KB
/
aliases
File metadata and controls
executable file
·61 lines (52 loc) · 2.42 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
#!/bin/bash
# Aliases for typing git commands really quickly.
# shellcheck disable=SC2139
alias gd_=$'git diff -M -D'
alias gd='gd_ --cached'
alias ga='git add -A'
alias justdoit='git add -A :/ && gd'
alias gf='git fetch --all --prune'
alias amend='git commit --amend --no-edit'
alias st='git status'
alias com='git commit -m'
alias gco='git checkout'
alias gls='git ls-tree -r --name-only'
# Creating quick ZIPs for git repos.
# shellcheck disable=SC2139
alias git-zip='git archive --format zip "$(git rev-parse HEAD)" --output'
# My custom command for deleting everything.
alias gw='git-wipeout'
alias gsquash='git merge --ff --squash'
# shellcheck disable=SC2139
alias nopyc=$'find `git rev-parse --show-toplevel` -name \'*.pyc\' -not -path \'*/site-packages/*\' -delete'
# shellcheck disable=SC2139
alias tracking=$'git for-each-ref --format=\'%(upstream:short)\' $(git symbolic-ref -q HEAD)'
# Find branches which have been merge to the dev branch.
# shellcheck disable=SC2139
alias merged-to-dev=$'git branch --merged dev | cut -c 3- | grep -P --invert-match \'^(?:master|dev|release/.+)$\''
# Add aliases for printing GitHub URLs for things.
# shellcheck disable=SC2139
alias git-current-remote-name=$'git rev-parse --abbrev-ref --symbolic-full-name @{u} | sed \'s:/.*$::\''
# shellcheck disable=SC2139
alias github-url=$'echo "https://github.com/$(git config --get remote.$(git-current-remote-name).url | grep -Po \'(?<=:).+(?=\\.git)\')"'
# shellcheck disable=SC2139
alias github-commit-url=$'echo "$(github-url)/commit/$(git rev-parse HEAD)"'
# shellcheck disable=SC2139
alias github-branch-url=$'echo "$(github-url)/tree/$(git rev-parse --abbrev-ref HEAD)"'
# Make GVim open files in a tab instead of a window.
alias gvim='~/script/unix/gvim'
# Add aliases for the OpenSSL commands I can never remember.
alias check-cert='openssl x509 -text -noout -in'
# Make `..` do `cd ..`
alias ..='cd ..'
# Add an alias for re-running hourly cron jobs.
alias rerun-hourly='crontab -l | grep ^@hourly | cut -f 2- -d " " | while read command; do eval $command; done'
# An alias for loading a missing apt key, using the Ubuntu key server.
alias load-apt-key='sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys'
# aliases specific to Mac OSX.
if [[ "$OSTYPE" =~ ^darwin ]]; then
# Automatically use the MacVim version of Vim.
if [ -f /Applications/MacVim.app/Contents/MacOS/Vim ]; then
alias vim=/Applications/MacVim.app/Contents/MacOS/Vim
fi
fi