Yesterday I had to clean some very old branches on a project’s codebase. Here’s a few git tricks I had to use.

List merged branch (excluding master and staging) :

git branch --merged | egrep -v "(^\*|master|staging)"

Delete them locally :

git branch --merged | egrep -v "(^\*|master|staging)" | xargs -n 1 git branch -d

Delete them remotely :

git branch -r --merged | grep -v "origin/master$" | grep -v "origin/staging$" | sed 's/\s*origin\///' | xargs -n 1 git push --delete origin
git remote prune origin

Source :

Display branches with oldest commit datetime :

for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r

Source :


sudo debconf-set-selections <<< "postfix postfix/main_mailer_type select Satellite system"
sudo debconf-set-selections <<< "postfix postfix/mailname string $HOSTNAME"
sudo debconf-set-selections <<< "postfix postfix/relayhost string"
sudo apt -y install postfix
sudo nano /etc/postfix/sasl_passwd

Ajouter la ligne suivante : your_mailgun_smtp_user@your_subdomain_for_mailgun:your_mailgun_smtp_password
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo nano /etc/postfix/

En fin de fichier, ajouter :

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = AUTH LOGIN

Modifier également la ligne relayhost :

relayhost =
sudo systemctl restart postfix
sudo ufw status
php -r "mail('', 'test', 'test');"

Pour terminer, on célèbre la victoire 🎉