Skip to content

Instantly share code, notes, and snippets.

@Teemu
Last active May 29, 2019 09:30
Show Gist options
  • Save Teemu/b839d573f2326e9e0055eec9aa4646f9 to your computer and use it in GitHub Desktop.
Save Teemu/b839d573f2326e9e0055eec9aa4646f9 to your computer and use it in GitHub Desktop.

Revisions

  1. Teemu renamed this gist May 29, 2019. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions useful_git_aliases.sh → useful_aliases.sh
    Original file line number Diff line number Diff line change
    @@ -6,3 +6,17 @@ alias rebasemaster='git checkout master && git pull && git checkout - && git reb
    alias updatebranch='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)'
    alias changed='git diff HEAD'
    alias gitbranch="git for-each-ref --color=always --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -15"
    killport () {
    if [ -z "`lsof -i tcp:${1:-5000}`" ]
    then
    echo "\e[31mNo processes found.\e[0m"
    else
    lsof -i tcp:${1:-5000}|awk '{ print $2 }' |grep -v 'PID'|xargs kill
    echo "Process killed."
    fi
    }
    alias lock="/System/Library/CoreServices/Menu\ Extras/user.menu/Contents/Resources/CGSession -suspend"
    sublime_as_editor () {
    export GIT_EDITOR='"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" -n -w'
    echo "Exported!"
    }
  2. Teemu created this gist May 29, 2019.
    8 changes: 8 additions & 0 deletions useful_git_aliases.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    alias gpu='git push -u origin $(git symbolic-ref --short HEAD)'
    alias gitbackup='git checkout -b backup/`git rev-parse --abbrev-ref HEAD`/`date +%Y%m%d-%H%M%S` && git checkout -'
    alias acommit='git add -A :/ && git commit -a'
    alias changedfiles='git diff --name-status master..`git rev-parse --abbrev-ref HEAD`'
    alias rebasemaster='git checkout master && git pull && git checkout - && git rebase master'
    alias updatebranch='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)'
    alias changed='git diff HEAD'
    alias gitbranch="git for-each-ref --color=always --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -15"