Cheatsheet SourceTree
Cliente Git gráfico gratuito para Windows e Mac
SourceTree
20
cards encontrados
Categorias:
Versões:
Ficheiro e Repo
Abrir / Clonar
Ctrl + O (abrir repo)
Ctrl + Shift + O (clonar)
File → New → Clone from URL
File → New → Create Local
Abrir repositórios.
Vistas
File Status # ficheiros alterados
History # log de commits
Branches # lista de ramos
Remotes # repositórios remotos
Stashes # alterações guardadas
Painéis principais.
Configuração
Tools → Options → Git
Configurar nome e email
Escolher versão do Git
SSH keys: Tools → Create SSH Key
Configurar SourceTree.
Commits
Fazer commit
Ctrl + Enter (commit)
File Status → selecionar ficheiros
Escrever mensagem
Commit / Commit & Push
Criar commit.
Stage / Unstage
Stage Selected → mover para staged
Unstage Selected → voltar a unstaged
Stage All / Unstage All
Discard → reverter alterações
Gerir staging area.
Amend e histórico
Clique direito no último commit
→ Amend Last Commit
→ Reset current branch to this commit
History → ver diff de cada commit
Modificar commits.
Diff e blame
Clique no ficheiro → ver diff
Botão direito → Annotate (blame)
Clicar numa linha → ver commit
Diff contra branch: right-click → Diff
Comparar alterações.
Branches
Criar branch
Ctrl + B (novo branch)
Branch → New Branch
Nome: feature/nova-funcionalidade
Checkout New Branch (mudar já)
Criar novo ramo.
Gerir branches
Clique direito no branch:
→ Checkout
→ Delete
→ Rename
→ Push to origin
→ Track remote branch
Operações em ramos.
Comparar branches
Selecionar 2 branches
→ Diff Against Current
Ver commits à frente/atrás
Log filtrado por branch
Comparar ramos.
Remoto
Push
Ctrl + Shift + P (push)
Push → selecionar branch
Push tags: incluir checkbox
Force push: Options → Force
Enviar para remoto.
Pull e Fetch
Ctrl + T (pull)
Ctrl + Shift + T (fetch)
Pull → Rebase instead of merge
Prune: remover refs obsoletas
Obter alterações remotas.
Remotos
Repository → Repository Settings
→ Remotes tab
Add / Edit / Remove remote
URL: https ou SSH
Gerir remotos.
Merge e Rebase
Merge
Checkout target branch
Clique direito no source branch
→ Merge
→ Squash commits (opcional)
Resolver conflitos no editor
Integrar branches.
Rebase
Clique direito no branch base
→ Rebase current branch onto
Interativo: resolver passo a passo
Abort: Actions → Resolve Conflicts → Abort
Rebase de branch.
Resolver conflitos
Ficheiros em conflito → destacados
Clique → Resolve Conflicts
→ Open in Merge Tool
Aceitar: Use Mine / Use Theirs
Mark Resolved → Commit
Resolver conflitos de merge.
Avançado
Stash
Ctrl + Shift + S (stash)
Repository → Stash
Apply Stash / Pop Stash
Drop Stash (apagar)
Guardar alterações temporárias.
Cherry-pick
History → selecionar commit
Clique direito → Cherry Pick
Aplica só esse commit
Útil para backports
Aplicar commit específico.
Tags
Repository → Create Tag
Nome: v1.0.0
Anotada: com mensagem
Push tag: Push → incluir tags
Criar e gerir tags.
Reset e revert
Clique direito no commit:
→ Reset to this commit
Soft / Mixed / Hard
→ Revert commit
(cria commit inverso)
Desfazer alterações.