Git useful commands and tricks

  1. Delete all merged branches
    git branch --merged master | grep -v master | xargs git branch -d
    
    //Or maybe you want to keep only few branches 
    git branch -D `git branch | awk '{ if ($0 !~ /<Branch_You_Want_to_Keep1>|<Branch_You_Want_to_Keep2>/) printf "%s", $0 }'`
    
  2. Add new origin
    git remote rm origin
    git remote add origin ssh://git@git.zitec.ro:6246/george.babarus/dpd_presta.git