Skip to content

Instantly share code, notes, and snippets.

@arturvt
Created April 16, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturvt/3d8fe2e31685557c20350f1f41c3f228 to your computer and use it in GitHub Desktop.
Save arturvt/3d8fe2e31685557c20350f1f41c3f228 to your computer and use it in GitHub Desktop.
Comandos úteis git.

Comandos uteis GIT

Deletando branches (local)

Deleta uma branch que já foi merged

git branch -d branchname

Deleta uma branch ainda não merged

git branch -D branchname

Remover referencias de branchs remotas que não existem mais git-fetch

Antes de atualizar, remove qualquer referência remota que não existe mais. git

git fetch origin --prune

Branches que foram merged

confirme que você atualizou o seu local com o remoto: git fetch origin

Lista branches que já foram merged stackoverflow

git branch --merged

Lista as branches que já foram merged mesnos as importantes

Neste cenário, develop e master são as importantes, não serão listadas.

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

Deletar branches que já foram merged

Remove todas as branches merged menos as importantes

Neste cenário, develop e master são as importantes, que não devem ser excluídas.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment