Skip to content

Commit 2dff50d

Browse files
authored
Merge pull request #1 from totalo-dev/jules-1365748801359271745-940ec96c
feat: Add 'Primeiros passos' filter with 24 basic git commands
2 parents 8dedab0 + f7a7e6a commit 2dff50d

2 files changed

Lines changed: 158 additions & 2 deletions

File tree

assets/js/script.js

Lines changed: 157 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,161 @@ const gitCommands = [
228228
}
229229
];
230230

231+
232+
const gettingStartedCommands = [
233+
{
234+
cmd: "git init",
235+
desc: { pt: "Inicializa um novo repositório Git no diretório atual.", en: "Initializes a new Git repository in the current directory." },
236+
example: "git init",
237+
category: "getting_started"
238+
},
239+
{
240+
cmd: "git clone",
241+
desc: { pt: "Clona um repositório remoto para sua máquina.", en: "Clones a remote repository to your machine." },
242+
example: "git clone <span>https://github.com/usuario/repositorio.git</span>",
243+
category: "getting_started"
244+
},
245+
{
246+
cmd: "git status",
247+
desc: { pt: "Exibe o estado atual dos arquivos do repositório.", en: "Displays the current state of the repository files." },
248+
example: "git status",
249+
category: "getting_started"
250+
},
251+
{
252+
cmd: "git add .",
253+
desc: { pt: "Adiciona todas as alterações para a área de staging.", en: "Adds all changes to the staging area." },
254+
example: "git add .",
255+
category: "getting_started"
256+
},
257+
{
258+
cmd: "git add <arquivo>",
259+
desc: { pt: "Adiciona um arquivo específico para a área de staging.", en: "Adds a specific file to the staging area." },
260+
example: "git add <span>index.html</span>",
261+
category: "getting_started"
262+
},
263+
{
264+
cmd: "git commit -m",
265+
desc: { pt: "Cria um commit com uma mensagem descritiva.", en: "Creates a commit with a descriptive message." },
266+
example: "git commit -m <span>\"Primeiro commit\"</span>",
267+
category: "getting_started"
268+
},
269+
{
270+
cmd: "git branch",
271+
desc: { pt: "Lista todas as branches locais.", en: "Lists all local branches." },
272+
example: "git branch",
273+
category: "getting_started"
274+
},
275+
{
276+
cmd: "git checkout -b",
277+
desc: { pt: "Cria uma nova branch e muda para ela.", en: "Creates a new branch and switches to it." },
278+
example: "git checkout -b <span>feature/login</span>",
279+
category: "getting_started"
280+
},
281+
{
282+
cmd: "git switch -c",
283+
desc: { pt: "Cria uma nova branch utilizando o comando moderno.", en: "Creates a new branch using the modern command." },
284+
example: "git switch -c <span>feature/login</span>",
285+
category: "getting_started"
286+
},
287+
{
288+
cmd: "git switch",
289+
desc: { pt: "Alterna para uma branch existente.", en: "Switches to an existing branch." },
290+
example: "git switch <span>main</span>",
291+
category: "getting_started"
292+
},
293+
{
294+
cmd: "git merge",
295+
desc: { pt: "Mescla uma branch na branch atual.", en: "Merges a branch into the current branch." },
296+
example: "git merge <span>feature/login</span>",
297+
category: "getting_started"
298+
},
299+
{
300+
cmd: "git remote add origin",
301+
desc: { pt: "Adiciona um repositório remoto.", en: "Adds a remote repository." },
302+
example: "git remote add origin <span>https://github.com/usuario/repositorio.git</span>",
303+
category: "getting_started"
304+
},
305+
{
306+
cmd: "git push -u origin main",
307+
desc: { pt: "Envia a branch principal para o repositório remoto e define o upstream.", en: "Pushes the main branch to the remote repository and sets the upstream." },
308+
example: "git push -u origin main",
309+
category: "getting_started"
310+
},
311+
{
312+
cmd: "git pull",
313+
desc: { pt: "Baixa e integra as alterações do repositório remoto.", en: "Downloads and integrates changes from the remote repository." },
314+
example: "git pull",
315+
category: "getting_started"
316+
},
317+
{
318+
cmd: "git fetch",
319+
desc: { pt: "Baixa as alterações do repositório remoto sem mesclá-las.", en: "Downloads changes from the remote repository without merging them." },
320+
example: "git fetch",
321+
category: "getting_started"
322+
},
323+
{
324+
cmd: "git log --oneline",
325+
desc: { pt: "Exibe um histórico resumido dos commits.", en: "Displays a summarized history of commits." },
326+
example: "git log --oneline",
327+
category: "getting_started"
328+
},
329+
{
330+
cmd: "git diff",
331+
desc: { pt: "Mostra as diferenças entre alterações.", en: "Shows differences between changes." },
332+
example: "git diff",
333+
category: "getting_started"
334+
},
335+
{
336+
cmd: "git restore",
337+
desc: { pt: "Restaura alterações em arquivos.", en: "Restores changes in files." },
338+
example: "git restore <span>arquivo.txt</span>",
339+
category: "getting_started"
340+
},
341+
{
342+
cmd: "git reset HEAD",
343+
desc: { pt: "Remove arquivos da área de staging sem apagar as alterações.", en: "Removes files from the staging area without deleting changes." },
344+
example: "git reset HEAD <span>arquivo.txt</span>",
345+
category: "getting_started"
346+
},
347+
{
348+
cmd: "git stash",
349+
desc: { pt: "Salva alterações temporariamente.", en: "Saves changes temporarily." },
350+
example: "git stash",
351+
category: "getting_started"
352+
},
353+
{
354+
cmd: "git stash pop",
355+
desc: { pt: "Recupera as alterações salvas no stash.", en: "Retrieves the saved changes from the stash." },
356+
example: "git stash pop",
357+
category: "getting_started"
358+
},
359+
{
360+
cmd: "git remote -v",
361+
desc: { pt: "Lista os repositórios remotos configurados.", en: "Lists the configured remote repositories." },
362+
example: "git remote -v",
363+
category: "getting_started"
364+
},
365+
{
366+
cmd: "git config --global user.name",
367+
desc: { pt: "Configura o nome do usuário do Git.", en: "Configures the Git user name." },
368+
example: "git config --global user.name <span>\"Seu Nome\"</span>",
369+
category: "getting_started"
370+
},
371+
{
372+
cmd: "git config --global user.email",
373+
desc: { pt: "Configura o e-mail do usuário do Git.", en: "Configures the Git user email." },
374+
example: "git config --global user.email <span>\"email@exemplo.com\"</span>",
375+
category: "getting_started"
376+
}
377+
];
378+
231379
const uiTranslations = {
232380
pt: {
233381
title: "<span class=\"git-text\">Git</span> Master",
234382
subtitle: "Aprenda, pesquise e teste os comandos essenciais do Git.",
235383
searchPlaceholder: "Buscar comando (ex: commit, add)...",
236384
filterAll: "Todos",
385+
filterGettingStarted: "Primeiros passos",
237386
filterBasics: "Básicos",
238387
filterBranching: "Branches",
239388
filterRemote: "Remoto",
@@ -250,6 +399,7 @@ const uiTranslations = {
250399
footer: "&copy; Totalo, todos os direitos reservados. Conteúdo gerado por IA, pode haver erros.",
251400
documentTitle: "Git Master - Revisão e Prática",
252401
categoryMap: {
402+
getting_started: 'Primeiros passos',
253403
basics: 'Básico',
254404
branching: 'Branches',
255405
remote: 'Remoto',
@@ -270,6 +420,7 @@ const uiTranslations = {
270420
subtitle: "Learn, search and test essential Git commands.",
271421
searchPlaceholder: "Search command (e.g. commit, add)...",
272422
filterAll: "All",
423+
filterGettingStarted: "Getting Started",
273424
filterBasics: "Basics",
274425
filterBranching: "Branching",
275426
filterRemote: "Remote",
@@ -286,6 +437,7 @@ const uiTranslations = {
286437
footer: "&copy; Totalo, all rights reserved. AI generated content, errors may occur.",
287438
documentTitle: "Git Master - Review & Practice",
288439
categoryMap: {
440+
getting_started: 'Getting Started',
289441
basics: 'Basics',
290442
branching: 'Branching',
291443
remote: 'Remote',
@@ -329,7 +481,8 @@ function applyUITranslations() {
329481
reviewModeBtn.textContent = t.reviewModeBtn;
330482

331483
// Filters
332-
document.querySelector('.filter-btn[data-filter="all"]').textContent = t.filterAll;
484+
document.querySelector('.filter-btn[data-filter=\"all\"]').textContent = t.filterAll;
485+
document.querySelector('.filter-btn[data-filter=\"getting_started\"]').textContent = t.filterGettingStarted;
333486
document.querySelector('.filter-btn[data-filter="basics"]').textContent = t.filterBasics;
334487
document.querySelector('.filter-btn[data-filter="branching"]').textContent = t.filterBranching;
335488
document.querySelector('.filter-btn[data-filter="remote"]').textContent = t.filterRemote;
@@ -568,7 +721,9 @@ function applyFilters() {
568721
return;
569722
}
570723

571-
const filtered = gitCommands.filter(cmd => {
724+
let commandsToFilter = category === 'getting_started' ? gettingStartedCommands : gitCommands;
725+
726+
const filtered = commandsToFilter.filter(cmd => {
572727
let matchesSearch = cmd.cmd.toLowerCase().includes(searchTerm) || cmd.desc[currentLang].toLowerCase().includes(searchTerm);
573728

574729
if (!matchesSearch && cmd.options) {

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h1>
4343

4444
<div class="filters" id="filters">
4545
<button class="filter-btn active" data-filter="all">Todos</button>
46+
<button class="filter-btn" data-filter="getting_started">Primeiros passos</button>
4647
<button class="filter-btn" data-filter="basics">Básicos</button>
4748
<button class="filter-btn" data-filter="branching">Branches</button>
4849
<button class="filter-btn" data-filter="remote">Remoto</button>

0 commit comments

Comments
 (0)