Abaixo estão os comandos git que uso repetidamente.
Clonar repositório
git clone https://github.com/tinymce/tinymce-dist.git
Adicionar arquivos git existentes a um repositório git remoto
cd /path/to/my/repo
git remote add origin https://lostinkali@bitbucket.org/lostinkali/flightstats.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags
Criar um repositório em uma pasta existente
git init
git add .
# Adds the files in the local repository and stages them for commit
git commit -m "Initial commit"
Mudar o branch atual para master
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch
Deletar Branch
git branch -D bugfix
Reverter para commit anterior
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master
adiciona o arquivo ao git.
git add [filename]
remove os arquivos não rastreados desde o commit mais recente no log.
git clean -fd
confirma os arquivos adicionados ao git.
git commit -m "enter message here"
Remove o arquivo do git. Use -f para forçar a remoção do arquivo mesmo quando há alterações.
git rm file1.txt
Marcando um ponto específico no tempo.
git tag -a v1.4 -m 'my version 1.4' Autor: Chuck Conway é um Engenheiro de IA com quase 30 anos de experiência em engenharia de software. Ele constrói sistemas de IA práticos—pipelines de conteúdo, agentes de infraestrutura e ferramentas que resolvem problemas reais—e compartilha o que está aprendendo ao longo do caminho. Conecte-se com ele nas redes sociais: X (@chuckconway) ou visite-o no YouTube e no SubStack.