GIT_STATUS - Verificar Status do Repositório
O que é este Node?
O GIT_STATUS é o node responsável por verificar o status atual do repositório Git, mostrando arquivos modificados, staging area e informações sobre branch.
Por que este Node existe?
Antes de executar operações Git, é importante saber o estado do repositório. O GIT_STATUS existe para:
- Diagnóstico: Ver estado atual do repositório
- Validação: Verificar antes de commit ou push
- Monitoramento: Detectar mudanças não commitadas
- Decisão: Determinar próximas ações baseado no status
Como funciona internamente?
Quando o GIT_STATUS é executado, o sistema:
- Valida repositório: Verifica se é repositório Git
- Executa status: Roda
git status - Captura output: Obtém informações completas
- Retorna dados: Disponibiliza status para análise
Código interno (git.executor.ts:141-144):
private async status(repoPath: string, context: ExecutionContext): Promise<any> {
const output = await this.execGit(repoPath, 'status', context);
return { output, status: output };
}
Quando você DEVE usar este Node?
Use GIT_STATUS quando precisar de verificar estado do repositório:
Casos de uso
- Pré-validação: "Verificar se há mudanças antes de commit"
- Monitoramento: "Detectar arquivos não versionados"
- Decisão: "Determinar se deve fazer pull ou push"
- Diagnóstico: "Ver estado antes de operações críticas"
Quando NÃO usar GIT_STATUS
- Após cada operação: Status não muda após fetch
- Sem necessidade de decisão: Use direto outras operações
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| operation | string | Sim | Deve ser "status" |
| repositoryPath | string | Sim | Caminho do repositório local |
| responseVariable | string | Não | Variável para armazenar resultado |
Exemplo 1: Verificar Antes de Commit
Objetivo: Checar status antes de criar commit
JSON para Importar
{
"name": "Status Antes de Commit",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "git_status_1",
"type": "git",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Check Status",
"operation": "status",
"repositoryPath": "/var/www/app",
"responseVariable": "status_result"
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Tem Mudanças?",
"parameters": {
"condition": "!{{status_result.status}}.includes('nothing to commit')"
}
}
},
{
"id": "git_add_1",
"type": "git",
"position": { "x": 700, "y": 50 },
"data": {
"label": "Add",
"operation": "add",
"repositoryPath": "/var/www/app",
"pathsToAdd": ".",
"responseVariable": "add_result"
}
},
{
"id": "git_commit_1",
"type": "git",
"position": { "x": 900, "y": 50 },
"data": {
"label": "Commit",
"operation": "commit",
"repositoryPath": "/var/www/app",
"message": "chore: automated commit",
"responseVariable": "commit_result"
}
},
{
"id": "message_committed",
"type": "message",
"position": { "x": 1100, "y": 50 },
"data": {
"label": "Sucesso",
"parameters": {
"message": "Mudanças commitadas!"
}
}
},
{
"id": "message_no_changes",
"type": "message",
"position": { "x": 700, "y": 150 },
"data": {
"label": "Sem Mudanças",
"parameters": {
"message": "Nada para commitar"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1300, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "git_status_1" },
{ "source": "git_status_1", "target": "condition_1" },
{ "source": "condition_1", "target": "git_add_1", "label": "true" },
{ "source": "condition_1", "target": "message_no_changes", "label": "false" },
{ "source": "git_add_1", "target": "git_commit_1" },
{ "source": "git_commit_1", "target": "message_committed" },
{ "source": "message_committed", "target": "end_1" },
{ "source": "message_no_changes", "target": "end_1" }
]
}
Exemplo 2: Monitoramento de Repositório
Objetivo: Verificar status e notificar se houver mudanças
JSON para Importar
{
"name": "Monitoramento Git Status",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "git_status_1",
"type": "git",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Check Status",
"operation": "status",
"repositoryPath": "/var/www/project",
"responseVariable": "status_check"
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Tem Uncommitted?",
"parameters": {
"condition": "{{status_check.status}}.includes('Changes not staged')"
}
}
},
{
"id": "message_alert",
"type": "message",
"position": { "x": 700, "y": 50 },
"data": {
"label": "Alerta",
"parameters": {
"message": "ATENÇÃO: Existem mudanças não commitadas!\n\n{{status_check.status}}"
}
}
},
{
"id": "message_clean",
"type": "message",
"position": { "x": 700, "y": 150 },
"data": {
"label": "OK",
"parameters": {
"message": "Repositório limpo"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "git_status_1" },
{ "source": "git_status_1", "target": "condition_1" },
{ "source": "condition_1", "target": "message_alert", "label": "true" },
{ "source": "condition_1", "target": "message_clean", "label": "false" },
{ "source": "message_alert", "target": "end_1" },
{ "source": "message_clean", "target": "end_1" }
]
}
Resposta do Node
{
"output": "On branch main\nYour branch is up to date with 'origin/main'.\n\nChanges not staged for commit:\n modified: src/app.js\n\nno changes added to commit",
"status": "On branch main\nYour branch is up to date with 'origin/main'.\n\nChanges not staged for commit:\n modified: src/app.js\n\nno changes added to commit"
}
Boas Práticas
✅ SIM: - Use status antes de operações importantes - Verifique status para decisões condicionais - Use para validar estado do repositório
❌ NÃO: - Não assuma status sem verificar - Não ignore warnings no output
Dicas
💡 Dica 1: Use CONDITION com status para fluxos condicionais
💡 Dica 2: Status mostra branch atual, mudanças e relação com remoto
💡 Dica 3: Combine com outros nodes Git para workflows completos
Próximo Node
→ GIT_ADD - Adicionar arquivos após verificar status → GIT_COMMIT - Commitar após validar mudanças → GIT_LOG - Ver histórico de commits