Person using macbook

Como resolver: macOS Sierra toda hora pedindo a senha da chave ssh

Desde que atualizei meu macbook pra versão 10.12.2, toda hora que ia dar um git pull ou push, eu recebia a mensagem pedindo para digitar a senha da minha chave ssh:

$ git pull
Enter passphrase for key '/Users/yogodoshi/.ssh/id_rsa':

Depois de tentar algumas soluções diferentes, incluindo usar o keychain, a que resolveu pra mim foi adicionar umas linhas no arquivo de config global ssh: ~/.ssh/config:

Host *
  AddKeysToAgent yes
  UseKeychain yes

É isso, espero que facilite a vida de uma galera que ficou de saco cheio tentando resolver esse problema, como eu 😜

Someone coding

How to delete local git branches after the merge

From time to time we all get annoyed by the git branch autocomplete, which used to be so useful, but now makes us practically write the whole branch name! 😡

Why it keeps happening? Because we are awesome developers who use feature branch flow and now, after working so hard, we have dozens of branches on our local machine.

Yogo, can you tell me an easy way to clear these branches? I don’t wanna delete each one manually! 😩

I sure can, my friend! Here is an alias that I use to delete all my merged branches:

alias clear_merged_branches="git branch --merged | egrep -v '(^\*|master|production)' | xargs git branch -d"

It will only leave the “master” and “production” branches, which you can easily change on that code. Besides the branches that haven’t been merged into master, of course.

Remember to use this alias while you are on the “master” branch 😉

Update

As lpmusix pointed out, you can also use it as a git alias. Add to the alias section of your ~/.gitconfig:

cb = "!git branch --merged | egrep -v '(^\\*|master|production)' | xargs git branch -d"