Skip to content

Instantly share code, notes, and snippets.

@berlotto
Last active January 31, 2017 16:52
Show Gist options
  • Save berlotto/7338779 to your computer and use it in GitHub Desktop.
Save berlotto/7338779 to your computer and use it in GitHub Desktop.
git commands
#Atualizar repositório local com todas as branchs remotas
git remote update
#Ver todas as branchs disponiveis, locais e remotas
git branch -a
#Criar branch local com base em branch remota
git checkout -b serverfix origin/serverfix
#Remover branch local
git branch -D serverfix
#Remover branch remota
git push origin :serverfix
#Setar branch remota para branch local
git branch --set-upstream serverfix origin/serverfix
#Buscar alterações remotas para branch local
git pull --rebase
#Enviar alterações para branch remota
git push
#or
git push origin serverfix
#Enviar alterações de uma branch para a master ( necessário estar na master )
git rebase serverfix
#Ver diferença de um arquivo específico entre dois commit
git diff 39cc492..8ccd15d path/to/the/file.py
#Ver quais arquivos foram alterados entre dois commit
git whatchanged 39cc492..8ccd15d
#Clonar repositorio fazendo clone dos submodulos junto
git clone --recursive https://github.com/user/server-repo local-folder
#Atualizar os submodulos em um repo
git submodule foreach git pull
#ou
git submodule update
#Buscar somente 1 commit de outra branch para a atual
git cherry-pick <HASHNUMBER>
#resetar a branch atual conforme a remote
git reset --hard origin/<branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment