Git
-
Upload
marco-antonio-filho -
Category
Documents
-
view
288 -
download
1
description
Transcript of Git
![Page 2: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/2.jpg)
LICENÇA
![Page 3: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/3.jpg)
MARCO ANTONIO FILHO
COORDENADOR DE TI INPACT.ME
![Page 4: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/4.jpg)
UMA VELHA HISTÓRIA
![Page 5: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/5.jpg)
A PRINCESA FOI CAPTURADA OS HERÓIS SURGEM REQUISITOS § Cadastro de heróis § Cadastro de times § Cadastro de masmorras (dungeons) § Envio de times a masmorras § Times devem batalhar entre si REGRAS UTILIZADAS Manual 3D&T de Marcelo Cassaro
![Page 6: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/6.jpg)
DUNGEON CRAWLER
Monte os seus personangens: goo.gl/qoRFp
Dungeon Character Team
Battle
![Page 7: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/7.jpg)
REGRAS - Criação de Personagens PERSONAGENS § Máximo de 7 pontos em características; § Máximo 5 em um atributo; § Pontos de Vida são calculados com base na
resistência (resistência x 1d);
![Page 8: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/8.jpg)
REGRAS - Batalhas PERSONAGENS 1. Jogadores jogam um dado. O maior valor inicia o combate; 2. Quem tem a iniciativa ataca. O dano é calculado em força ou poder de fogo x d6; 3. O oponente defende. A defesa é calculada pela armadura x d6; 4. Os pontos de vida são reduzidos pela diferença: ataque - defesa; 5. O oponente ataca; 6. Aquele que for nocauteada (pontos de vida menor que zero) é o perdedor;
![Page 9: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/9.jpg)
INTRODUZINDO O CONTROLE DE VERSÃO GIT
![Page 10: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/10.jpg)
PROBLEMAS DE COLABORAÇÃO
![Page 11: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/11.jpg)
CONTROLE DE VERSÃO
TEMPO
MERGE
![Page 12: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/12.jpg)
INICIALIZANDO GIT
$ git config -‐-‐global user.name "Marco Antonio Filho" $ git config -‐-‐global user.email "[email protected]" $ git config -‐-‐global color.ui true
Execute no terminal
Configuração do seu usuário git.
Inicialize o seu projeto
$ mkdir save-‐the-‐princess $ cd save-‐the-‐princess $ git init
![Page 13: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/13.jpg)
MARKDOWN CONVERSOR TEXTO-HTML
Útil para documentação simples de uma plataforma.
Um cabeçalho de nível 1 ======================= Um cabeçalho de nível 2 -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ Isso é um paragráfo e abaixo é uma lista * Item 1 * Item 2 * Item 3
![Page 14: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/14.jpg)
EXERCÍCIO OBJETIVO
Configurar e inicializar um repositório local e adicionar alguns arquivos
MÉTODO
§ Configurar git com o seu usuário (dica: git config);
§ Inicializar um repositório dentro da pasta do seu projeto (dica: git init);
§ Escrever um arquivo README.md explicando o que é o programa (dica: google markdown);
§ Criar uma página html que contenha uma lista de personagens (characters); § Nome (Name) e Classe (Class);
§ Força (Strength), Habilidade (Skill), Resistência (Resistance), Armadura (Armor), Poder de Fogo (Fire Power);
30 MIN
![Page 15: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/15.jpg)
FLUXO DE DESENVOLVIMENTO GIT
![Page 16: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/16.jpg)
FLUXO GIT
Working directory
LOCAL REMOTO
Staging Area Remote Repository Local Repository
git add
git commit
git push
git pull
git checkout
git merge
![Page 17: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/17.jpg)
GIT STATUS VERIFICA O ESTADO CORRENTE DO DIRETÓRIO
$ git status # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # README.md # characters_index.html
![Page 18: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/18.jpg)
ADICIONANDO AO PALCO DEVEMOS COMEÇAR A RASTREAR AS MUDANÇAS
$ git add README.md characters_index.html $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm -‐-‐cached <file>..." to unstage) # # new file: README.md # new file: characters_index.html #
![Page 19: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/19.jpg)
ARMAZENANDO UMA FOTO GUARDANDO UMA FOTO NO REPOSITÓRIO LOCAL
$ git commit -‐m "Initial commit" $ git status # On branch master nothing to commit (working directory clean)
![Page 20: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/20.jpg)
EXERCÍCIO OBJETIVO
Armazenar arquivos no repositório local através de commits
MÉTODO
§ Adicionar arquivos para a staging area (dica: git add);
§ Salvar alterações no repositório local (dica: git commit);
§ Criar uma página com a lista de masmoras (dungeons); § Nome (Name);
§ Navegação entre masmorras e personagens; § Realizar mesmo processo para salvar alterações no repositório local; § Bônus: Adicionar css à página.
30 MIN
![Page 21: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/21.jpg)
HISTÓRICO É POSSÍVEL VER QUAIS AS ALTERAÇÕES FEITAS
$ git log commit 19dd00d4913497107ef6de07e0ee00a9b9315304 Author: Marco Antonio Filho <[email protected]> Date: Thu Apr 11 02:51:03 2013 -‐0300 Creating index and modifying README.md commit a44995e61542e54aa88e55908cf09133578a43f6 Author: Marco Antonio Filho <[email protected]> Date: Thu Apr 11 02:37:13 2013 -‐0300 Initial commit
![Page 22: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/22.jpg)
FLUXO GIT
Working directory
LOCAL REMOTO
Staging Area Remote Repository Local Repository
git add
git commit
git push
git pull
git checkout
git merge
![Page 23: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/23.jpg)
COMPREENDENDO STAGING AREA
![Page 24: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/24.jpg)
DIFERENÇAS ENTRE COMMITS PODEMOS VER O QUE MODIFICAMOS EM RELAÇÃO AO REPOSITÓRIO LOCAL
$ git diff diff -‐-‐git a/README.md b/README.md index 9d1d09d..61f26f8 100644 -‐-‐-‐ a/README.md +++ b/README.md @@ -‐1,2 +1,4 @@ My dungeon crawlers =================== + +A warrior should fight with his heart instead of his sword. $ git add README.md $ git diff
![Page 25: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/25.jpg)
ADD ACIDENTAL COMO FAZER PARA REMOVER ARQUIVOS ADICIONADOS ACIDENTALMENTE?
$ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: README.md # $ git reset HEAD README.md Unstaged changes after reset: M README.md
![Page 26: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/26.jpg)
DESCARTANDO MODIFICAÇÕES E SE EU QUISER VOLTAR COMO ESTAVA ANTES?
$ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -‐-‐ <file>..." to discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -‐a") $ git checkout -‐-‐ README.md $ git status
![Page 27: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/27.jpg)
REFAZENDO COMMITS E SE EU ESQUECI DE ADICIONAR ALGUMA COISA?
$ git reset -‐-‐soft HEAD^ $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: README.md # new file: dungeons_index.html #
![Page 28: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/28.jpg)
ADICIONANDO A UM COMMIT E SE EU ESQUECI DE ADICIONAR ALGUMA COISA?
$ git add dungeon_new.html $ git commit -‐-‐amend -‐m "Adding dungeon index and form"
![Page 29: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/29.jpg)
COMPARTILHANDO REPOSITÓRIOS
![Page 30: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/30.jpg)
REPOSITÓRIO REMOTO
git push
git pull
git pull
![Page 31: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/31.jpg)
GITHUB
![Page 32: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/32.jpg)
ADICIONANDO COLABORADORES
![Page 33: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/33.jpg)
ADICIONANDO O SERVIDOR REMOTO PRECISAMOS DEFINIR QUEM VAI SER O NOSSO SERVIDOR CENTRAL
$ git remote add origin https://github.com/<user>/<project>.git $ git push -‐u origin master
$ git pull
PARA QUE AS PESSOAS PEGUEM AS MODIFICAÇÕES DO REPOSITÓRIO REMOTO
$ git clone https://github.com/<user>/<project>.git [<folder>]
PARA QUE AS PESSOAS PEGUEM O REPOSITÓRIO REMOTO
![Page 34: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/34.jpg)
EXERCÍCIO OBJETIVO
Crie um repositório remoto e colabore com o do colega
MÉTODO
§ Crie o seu repositório no github e envie o seu código (dica: git remote e git push);
§ Adicione o colega do seu lado como colaborador como colaborador;
§ Crie uma cópia do repositório do seu colega (dica: git clone);
§ Sem contar o que está fazendo, faça as alterações que desejar no projeto dele; § Envie as suas alterações para o github (dica: git push); § Volte para o diretório do seu projeto e pegue as alterações feitas pelo seu colega (dica: git pull); § Identifique as alterações feitas sem perguntar para o colega que as modificou.
30 MIN
![Page 35: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/35.jpg)
MAIS SOBRE COLABORAÇÃO
![Page 36: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/36.jpg)
BRANCHES É MELHOR CRIAR FUNCIONALIDADES EM BRANCHES
$ git branch char
MASTER
CHAR
$ git branch char * master
LISTAR BRANCHES
ACESSAR BRANCH
$ git checkout char Switched to branch 'char'
HEAD
![Page 37: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/37.jpg)
EXERCÍCIO OBJETIVO
Crie uma branch e nessa branch crie um formulário para characters
MÉTODO
§ Crie uma branch (dica: git branch);
§ Vá para a branch (dica: git checkout);
§ Crie um formulário para salvar personagens;
§ Faça o commit dessa funcionalidade;
§ Volte para a branch master.
§ O que foi que aconteceu?
15 MIN
![Page 38: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/38.jpg)
MERGE BRANCHES TERMINAMOS A FUNÇÃO CHAR. É HORA DE FUNDIR AS BRANCHES
$ git checkout master $ git merge char Updating c8541d6..a226599 Fast-‐forward 0 files changed, 0 insertions(+), 0 deletions(-‐) create mode 100644 chars_new.html
REMOVER BRANCH
$ git branch -‐d char
MASTER
CHAR
HEAD
![Page 39: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/39.jpg)
RESOLVENDO CONFLITOS E QUANDO DUAS PESSOAS MEXEM NO MESMO ARQUIVO?
$ git push ! [rejected] master -‐> master (non-‐fast-‐forward)
ARQUIVO COM CONFLITO!
$ git pull CONFLICT (content): Merge conflict in char.html
MASTER
CHAR
HEAD
char.html IMPORTANTE! REALIZAR GIT PULL ANTES DE GIT PUSH!
![Page 40: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/40.jpg)
RESOLVENDO CONFLITOS ARQUIVO COM CONFLITO
<<<<<<< HEAD <title>DungeonCrawlers Generations</title> ======= <title>Dungeon Crawlers</title> >>>>>>> 7a61a9b596cdd07120e36f4f916ee65036d5c179
Seu repositório
Repositório remoto
FIX, COMMIT AND PUSH!!!
![Page 41: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/41.jpg)
EXERCÍCIO OBJETIVO
Resolvendo conflitos no seu repositório
MÉTODO
§ Combine em uma linha para que o seu colega faça uma modificação;
§ Faça uma modificação na mesma linha;
§ Faça um commit e push no repositório do seu colega;
§ Faça um commit e pull no seu repositório; § Tente agora resolver o conflito; § Quando o arquivo estiver corrigido, faça commit e push.
15 MIN
![Page 42: Git](https://reader031.fdocumentos.com/reader031/viewer/2022020123/559b9d161a28ab1e448b4680/html5/thumbnails/42.jpg)
DÚVIDAS
? ? ?
?
?
? ?
? ?
?
? ?