Skip to content

Instantly share code, notes, and snippets.

View marciofmjr's full-sized avatar
🕷️
🕸

Marcio Junior marciofmjr

🕷️
🕸
View GitHub Profile
git stash
# Para listar os stash salvos
git stash list
# Para ver os arquivos alterados de um stash
git stash show stash@{0}
# Para ver os detalhes de um stash
git stash show -p stash@{0}
git show
# Exibir detalhes do último commit de uma tag
git show v1.0
# Exibir detalhes do último commit da branch master
git show master
# Exibir detalhes de um commit específico
git show 6eaaa8e0fec99e0e7a897ebb91dd4d6f689e4d1d
git diff
# Diferença entre dois commits
git diff 9a6633e093a4276a8c862773b308cb1f28728f2f..c22aaa1a1555a0100ef710e3bd4928cdcd80fe7d
# Diferença entre branch atual e outra branch
git diff feat-new-screen
# Diferença entre branch atual e branch remota
git diff origin/feat-new-screen
git checkout NOME_DO_ARQUIVO
# Exemplo
git checkout README.md
# Também é possível resetar mais de um arquivo por vez
git checkout .
# Ou resetar uma pasta específica
git checkout src/
git reset NOME_DO_ARQUIVO
# Exemplo:
git reset README.md
git config
# Para configurar local (para cada projeto)
git config --local
# Para configurar de forma geral para todos os projetos
git config --global
# Configurar nome de usuário
git config --global user.name "Marcio Junior"
git commit --amend
git log
# Exibir commits em uma versão mais compacta
git log --oneline
# Exibir commits junto com a linha do tempo
git log --graph
git tag NOME_DA_TAG IDENTIFICADOR_DO_COMMIT
# Exemplo
git tag v1.0 b99adae37b3bdcd9f74fa333e74a11361f85b9ac
git merge --abort