Guia Rápido de Git
Comandos Git com parâmetros - pequena referência
Conteúdo da página
Here’s a little cheatsheet: Git commands with params
This streetscape image is generated by AI model Flux 1 dev.
Basic Commands
git init
: Inicializar um novo repositório Gitgit clone <url>
: Criar uma cópia local de um repositório remotogit add <file>
: Preparar alterações para commitgit commit -m "<message>"
: Salvar alterações no repositório local com uma mensagemgit status
: Verificar o status do diretório de trabalhogit log
: Verificar o histórico de commits
Branching and Merging
git branch
: Listar todas as branches locaisgit branch <branch-name>
: Criar uma nova branchgit checkout <branch-name>
: Migrar para uma branch diferentegit checkout -b <branch-name>
: Criar e migrar para uma nova branchgit merge <branch>
: Mesclar a branch especificada na branch atual
Remote Repositories
git remote add <name> <url>
: Adicionar um repositório remotogit push <remote> <branch>
: Enviar commits locais para um repositório remotogit pull
: Obter e mesclar alterações do repositório remotogit fetch
: Baixar alterações do repositório remoto
Undoing Changes
git reset <file>
: Desfazer alterações mantendo-as no diretório de trabalhogit reset --hard <commit>
: Descartar todas as alterações e mover para um commit específicogit revert <commit>
: Criar um novo commit que desfaz as alterações de um commit específico
Advanced Commands
git stash
: Armazenar temporariamente arquivos modificadosgit stash pop
: Aplicar e remover o último stashgit rebase <branch>
: Reaplicar commits sobre outra basegit cherry-pick <commit>
: Aplicar um commit específico na branch atualgit tag <tag-name>
: Criar uma tag leve no commit atual
Configuration
git config --global user.name "<Your Name>"
: Definir o nome para seus commitsgit config --global user.email "<you@example.com>"
: Definir o e-mail para seus commits
Substitua os espaços reservados como <file>
, <url>
, <branch-name>
, etc., por valores reais ao usar esses comandos.
Useful links
- https://en.wikipedia.org/wiki/Git
- https://www.atlassian.com/git/tutorials/atlassian-git-cheatsheet
- https://about.gitlab.com/images/press/git-cheat-sheet.pdf
- https://education.github.com/git-cheat-sheet-education.pdf
Other cheatsheets
- PowerShell Cheatsheet
- cURL Cheatsheet
- Bash Cheat Sheet
- Hugo Cheat Sheet
- Golang Cheat Sheet
- LaTeX Cheat Sheet
- Ollama cheatsheet
- Docker Cheatsheet
- Kubernetes Cheatsheet
- [Python Cheatsheet](https://www.glukhov.org/pt/post/2024/08/python-cheat-sheet/ “Python Cheatsheet”