Skip to content

Instantly share code, notes, and snippets.

@d4vidi
Created November 30, 2020 09:23
Show Gist options
  • Save d4vidi/3743cba943f9bebed9f8f9cba1bb249d to your computer and use it in GitHub Desktop.
Save d4vidi/3743cba943f9bebed9f8f9cba1bb249d to your computer and use it in GitHub Desktop.
alias ll='exa -alF'
alias lt='exa --tree'
alias lt2='exa --tree --level=2'
alias lt3='exa --tree --level=3'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# Git and Github
alias gits='git status'
alias gitss='git status -s'
alias gs='git status'
function gss() {
LINES="$@"
if [ -z "$1" ]; then
# script -q /dev/null git status -s | grep -n ''
script -q /dev/null git status -s | nl
else
GIT_STATUS=`git status -s`
files=""
for i in ${LINES}; do
file=$(echo "$GIT_STATUS" | awk '{print $2}' | head -"$i" | tail -1)
files+="$file "
done
echo $files
fi
}
function gitadd() {
git add `gss $@`
}
alias gp='git pull'
alias gpr='git pull -r'
alias thisbranch='git rev-parse --abbrev-ref HEAD'
function gitupstream() {
echo "Setting upstream for: `git rev-parse --abbrev-ref HEAD`"
git push --set-upstream origin `git rev-parse --abbrev-ref HEAD`
}
function cpbranch() {
BRANCH=`thisbranch`
echo "$BRANCH" | pbcopy
echo "$BRANCH copied to clipboard"
}
alias giturl="git config --get remote.origin.url | sed 's com: com/ g' | sed 's git@ https:// g' | sed 's \.git g'"
alias github="giturl | xargs open"
function githubcommit() {
open `giturl`/commit/$@
}
function githubbranch() {
open `giturl`/tree/`thisbranch`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment