Good


WTF is GIT?

É um sistema de controle de versão (VCS) distribuído
Centralizado | Distribuído | |
---|---|---|
Deltas | subversion | mercurial |
DAGs | bitkeeper | git |






- Rápido;
- Simples;
- Suporte robusto para várias branches em paralelo;
- Totalmente distribuido;
- Capaz de suportar projetos gigantescos como o Kernel do Linux;
- GIT não deleta!
Por quê?


Workflow

Usando o GIT
Configurações
Configurar o git é algo extremamente complexo...
$ git config --global user.name "DarthVader"
$ git config --global user.email darthvader@empire.org
Sua identidade
Criando repositórios
$ git init
Cria um repositório local
$ git clone <url-do-repositorio-git>
$ git clone https://detailyang/awesome-cheatsheet.git # https
$ git clone git@github.com:detailyang/awesome-cheatsheet.git # ssh
Clona um repositório existente
A tabuada do GIT
$ git add README.md # adicionar um arquivo ao repo
$ git rm main.c # remover um arquivo do repo
$ git commit -am 'First commit' # gravar as mudanças realizadas
$ git log # exibe o log de commits realizados
$ git show # exibe os commits
$ git diff # exibe a diferença entre o que foi modificado e o que está "commitado"
Deu ruim!!!
$ git checkout -- arquivo.txt # reverter o arquivo para último "savepoint"
$ git revert <SHA-do-commit> # reverter um commit

Gitflow
Maximizando o poder do git

Branches
$ git branch teste1 # cria uma nova branch a partir da HEAD
$ git checkout -b teste1 # cria uma branch e troca o contexto para ela
Componentes do git flow
- Branch MASTER
- Branch DEVELOP
- Branch FEATURE-X
- Branch RELEASE
- Branch HOTFIX
Solução de conflitos


Links Úteis
- Git Flight Rules
- GitKraken Gitflow
- VSCode extension: GitLens, GitHistory
- Goal Kicker books
Obrigado!
/deadpyxel

Git Good
By Robson Cruz
Git Good
Apresentação utilizada no mini-treinamento de Git e Gitflow para a EJCOMP
- 153